Linux / Unix Command Examples

Here are links to some useful Linux tips:

Awesome. VIM “for people who don’t want to use it , but have to…”. Or see my page

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


  1. Tomi Engdahl says:

    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.

  2. Tomi Engdahl says:

    How to Monitor Linux Server and Process Metrics from Browser

  3. Tomi Engdahl says:

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

  4. Tomi Engdahl says:

    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.

  5. Tomi Engdahl says:

    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.

  6. Tomi Engdahl says:

    7 ‘dmesg’ Commands for Troubleshooting and Collecting Information of Linux Systems

  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

  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

  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.

  10. Tomi Engdahl says:

    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.

  11. Tomi Engdahl says:

    Query your Linux operating system like a database
    Use database-style queries to get system information easily.

    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.

  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?

  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.


Leave a Comment

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