Linux / Unix Command Examples

Here are links to some useful Linux tips:

https://www.cyberciti.biz/faq/linux-unix-appleosx-bsd-cat-command-examples/

https://peteris.rocks/blog/htop/

https://www.cyberciti.biz/faq/searching-multiple-words-string-using-grep/

https://www.cyberciti.biz/faq/using-sed-to-delete-empty-lines/

https://www.cyberciti.biz/faq/linux-hide-processes-from-other-users/

https://www.cyberciti.biz/faq/bash-check-if-process-is-running-or-notonlinuxunix/

https://www.cyberciti.biz/faq/unix-linux-bsd-appleosx-bash-assign-variable-command-output/

http://unixmillenniumbug.com/

https://bash.cyberciti.biz/file-management/linux-shell-script-to-reduce-pdf-file-size/

https://www.cyberciti.biz/faq/bash-file-command-not-found-how-to-install-file/

https://www.cyberciti.biz/faq/set-up-a-basic-iptables-firewall-on-amazon-linux-ami/

https://www.cyberciti.biz/faq/fedora-redhat-centos-5-6-disable-firewall/

https://bash.cyberciti.biz/virtualization/shell-script-to-setup-an-lxd-linux-containers-vm-lab-for-testing-purpose/

https://hackertarget.com/ossec-introduction-and-installation-guide/

Awesome. VIM “for people who don’t want to use it , but have to…”. Or see my page https://www.cyberciti.biz/faq/linux-unix-vim-save-and-quit-command/

sudo is the right choice for granting admin rights on the CentOS Linux 8 server. Learn how to create a new user and grant her admin rights https://www.cyberciti.biz/faq/add-create-a-sudo-user-on-centos-linux-8/

325 Comments

  1. Tomi Engdahl says:

    Linux Fu: A Little Bit Of (Network) History Repeating Itself
    https://hackaday.com/2021/04/26/linux-fu-a-little-bit-of-network-history-repeating-itself/

    These days, embedded systems often have networks and that can make them significantly more complex. Networks are usually pretty nondeterministic and there are a variety of oddball conditions. For example, when your public-access pick and place machine gets written up on Hackaday and you suddenly get a 50X surge in traffic, how does your network stack handle it? While there’s no silver bullet for network testing, there are some tricks that can make it easier and one of those is the tcpreplay utilities that allow you to record complex network traffic and then play it back in a variety of ways. This has many benefits, especially if you manage to capture that one thing that triggers bad behavior sporadically. Being able to play it back on demand can speed up diagnostics considerably.

    Reply
  2. Tomi Engdahl says:

    How to Monitor Linux Server and Process Metrics from Browser

    https://www.tecmint.com/monitor-linux-server-in-realtime/

    Reply
  3. Tomi Engdahl says:

    How to Test Your Internet Speed Bidirectionally from Command Line Using ‘Speedtest-CLI’ Tool

    https://www.tecmint.com/check-internet-speed-from-command-line-in-linux/

    Reply
  4. Tomi Engdahl says:

    Linux Fu: Databases Are Next-Level File Systems
    https://hackaday.com/2021/06/08/linux-fu-databases-are-next-level-file-systems/

    It is funny how exotic computer technology eventually either fails or becomes commonplace. At one time, having more than one user on a computer at once was high tech, for example. Then there are things that didn’t catch on widely like vector display or content-addressable memory. The use of mass storage — especially disk drives — in computers, though has become very widespread. But at one time it was an exotic technique and wasn’t nearly as simple as it is today.

    However, I’m surprised that the filesystem as we know it hasn’t changed much over the years. Sure, compared to, say, the 1960s we have a lot better functionality. And we have lots of improvements surrounding speed, encoding, encryption, compression, and so on. But the fundamental nature of how we store and access files in computer programs is stagnant. But it doesn’t have to be. We know of better ways to organize data, but for some reason, most of us don’t use them in our programs. Turns out, though, it is reasonably simple and I’m going to show you how with a toy application that might be the start of a database for the electronic components in my lab.

    You could store a database like this in a comma-delimited file or using something like JSON. But I’m going to use a full-featured SQLite database to avoid having a heavy-weight database server and all the pain that entails. Is it going to replace the database behind the airline reservation system? No. But will it work for most of what you are likely to do? You bet.

    The Right Tool for the Right Job

    Of course, there are limitations. However, if you are rolling your own file format for something, you might want to consider switching to SQLite and handling it as a database. According to the project’s website, doing so may actually save space and increase access speed. Plus, once you get the hang of it, it is just easier. It is also easier to scale later if you decide to switch to a real database.

    The C code will turn out to be the least of our problems. The two things you’ll want to understand most are how to structure the data — the database schema — and how to populate the initial data. Even if you want to have your program add data eventually, it is nice to start with a little data initially to get your program working.

    Reply
  5. Tomi Engdahl says:

    Branch Out Your SQLite Database With LiteTree
    https://hackaday.com/2018/09/02/branch-out-your-sqlite-database-with-litetree/

    Whether you want some quick and dirty data storage, or simply don’t have that heavy requirements for your local database system, SQLite is always a good choice. With its portable single-file approach, bindings to all major languages, and availability on systems of all sizes, it is relatively easy to integrate a SQLite database in your undertakings. And if you tend to develop directly in your production environment, you may be interested to hear that the folks at [aergo] made this a lot more flexible (and interesting) by adding Git-style branching to the SQLite engine.

    Similar to Git, each database operation is now stored as a commit with a unique id as reference point, and new branches will keep track how they diverge from their parent reference point. This essentially lets you modify your data set or database schema on the fly, while keeping your original data not only untouched, but fully isolated and functional. Unfortunately, merging branches is not yet supported, but it is planned for the near future.

    https://github.com/aergoio/litetree

    Reply
  6. Tomi Engdahl says:

    7 ‘dmesg’ Commands for Troubleshooting and Collecting Information of Linux Systems
    https://www.tecmint.com/dmesg-commands/

    Reply
  7. Tomi Engdahl says:

    Identify security properties on Linux using checksec
    Learn how to use checksec to identify an executable’s security properties, understand what they mean, and know how to use them
    https://opensource.com/article/21/6/linux-checksec

    Reply
  8. Tomi Engdahl says:

    Learn more about your Linux system with inxi
    Gather a variety of system and non-system information with a single Linux command: inxi
    https://www.redhat.com/sysadmin/learn-more-inxi

    Reply
  9. Tomi Engdahl says:

    CloudLinux releases UChecker security tool for Linux servers
    CloudLinux, best known for its CentOS work, is releasing UChecker, its Linux server security scanner.
    https://www.zdnet.com/article/cloudlinux-releases-uchecker-security-tool-for-linux-servers/

    Reply
  10. Tomi Engdahl says:

    Coding A Custom Driver For The Adafruit Mini Thermal Printer
    https://hackaday.com/2021/06/26/coding-a-custom-driver-for-the-adafruit-mini-thermal-printer/

    Thermal printers are cool… or, uh, warm actually. They use heat to make images, so they never need ink and they print on receipt rolls. The thermal printer available from Adafruit is a particularly tasty example, as it comes fully documented for the budding hacker. [Ed] is one such person, who set about writing his own driver to use the hardware with Linux on a Raspberry Pi.

    The project came about as [Ed] didn’t like the halftone output from the standard Adafruit CUPS driver. Thus, a dithering-capable driver was needed instead.

    https://deathandthepenguinblog.wordpress.com/2019/12/08/adafruit-mini-thermal-printer-part-1-getting-better-pictures/

    Reply
  11. Tomi Engdahl says:

    Query your Linux operating system like a database
    Use database-style queries to get system information easily.
    https://opensource.com/article/21/6/osquery-linux

    Linux offers a lot of commands to help users gather information about their host operating system: listing files or directories to check attributes; querying to see what packages are installed, processes are running, and services start at boot; or learning about the system’s hardware.

    Each command uses its own output format to list this information. You need to use tools like grep, sed, and awk to filter the results to find specific information. Also, a lot of this information changes frequently, leading to changes in the system’s state.

    It would be helpful to view all of this information formatted like the output of a database SQL query. Imagine that you could query the output of the ps and rpm commands as if you were querying an SQL database table with similar names.
    Fortunately, there is a tool that does just that and much more: Osquery is an open source “SQL powered operating system instrumentation, monitoring, and analytics framework.”

    Many applications that handle security, DevOps, compliance, and inventory management (to name a few) depend upon the core functionalities provided by Osquery at their heart.

    https://osquery.io/

    Reply
  12. Tomi Engdahl says:

    Vim vs. Nano vs. Emacs: Three sysadmins weigh in
    Three editors. Three experts. Which Linux text editor is right for you?
    https://www.redhat.com/sysadmin/3-text-editors-compared

    Reply
  13. Tomi Engdahl says:

    Send and receive Gmail from the Linux command line
    Use Mutt to send and receive email from your terminal, even if you’re using hosted service such as Gmail.
    https://opensource.com/article/21/7/gmail-linux-terminal

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *

*

*