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:

    SSH ProxyCommand example: Going through one host to reach another server #Linux #Unix #macOS #SysAdmin #DevOps

  2. Tomi Engdahl says:

    Bash is one of the most popular shells for Linux/Unix users and developers. It just got better with a new version that includes enhanced random number generation. Let us take a quick look at new features and learn how to install the latest GNU/BASH 5.1.

  3. Tomi Engdahl says:

    Want to run commands as another user on your Linux desktop or server? Try su, sudo, kpexec, and runuser commands.

  4. Tomi Engdahl says:

    With its 288 RGB LEDs, this Arduino-controlled cylinder puts on quite the show!

  5. Tomi Engdahl says:

    Beginner’s Guide to Analyzing Logs in Linux With journalctl Command
    Beginner’s guide to using journalctl commands for viewing, filtering and analyzing journal logs in Linux.

  6. Tomi Engdahl says:

    //Did you know you can colorize and print all IP addresses and interfaces on Linux in a tabular format for better readability?

    ip -br -c addr show
    ip -br -c link show

    See our ip command guide pretty cool, huh? #Linux #SysAdmin #devops

  7. Tomi Engdahl says:

    //{Updated} In this in-depth tutorial, we will explain to read, list and set environment and shell variables on Linux including read-only and persistent configs. #sysadmin #Linux #programming

  8. Tomi Engdahl says:

    //Do you want to see a list or find open ports on your server from Linux, macOS, FreeBSD or Unix-like systems when Nmap is not installed? Try netcat/nc command. It is simple yet effective for offensive and defensive purposes. No root access needed:

    nc -w1 -zv your-server-ip 1-1023 2>&1 | grep succeeded

    See for more info.

  9. Tomi Engdahl says:

    A bash script that will automatically install a list of bug hunting tools that I find interesting for recon, exploitation, etc. (minus burp) For Ubuntu/Debain. Feel free to fork, and add your own tools.

  10. Tomi Engdahl says:

    //Display http/ftp status code from Linux, macOS and Unix-like systems. Useful to see if a remote website is up or down without using 3rd party service. HTTP/200 means up and running:

    curl -L -o /dev/null -s -I -w ‘%{http_code}\n’ url

    See for more examples.

  11. Tomi Engdahl says:

    // Learn how to configure Intel WiFi on Debian Linux 10 or 11 when you need a binary blob. #sysadmi #Debian #Linux

  12. Tomi Engdahl says:

    //This page explains how to change/update your LUKS disk encryption passphrase when you initially set a weak passphrase that protects your Linux disk data. Useful for rotating passphrase is also good security practice. #Linux #Sysadmin #IT #security

  13. Tomi Engdahl says:

    Let us start a flame fest over a text editor: Top six awesome text/CLI editors for Linux, macOS and Unix devs/users. #programming #UNIX #Linux #SysAdmin #MacOS #bsd

  14. Tomi Engdahl says:

    //Rolling back to the previous version may solve the problem or free the disk space. Both CentOS/RHEL support rollback feature, but I learned hard way both Debian and Ubuntu Linux does not support rollback feature yet. #sysadmin

  15. Tomi Engdahl says:

    //Ubuntu 20.04 add network bridge (br0) with nmcli command #Linux #SysAdmin

  16. Tomi Engdahl says:

    Learn how to use tar over ssh for moving files securely, quick backups and more. #Linux #UNIX #macOS #Sysadmin #devlife

  17. Tomi Engdahl says:

    //tuptime – Linux See Historical and Statistical Uptime of System Works on both #Linux and #FreeBSD.

  18. Tomi Engdahl says:

    //How to issue Let’s Encrypt wildcard certificate with and Cloudflare DNS Are you using AWS route 53 DNS? See how use Route 53 to get Let’s Encrypt wildcard certificate with and DNS auth

  19. Tomi Engdahl says:

    Did you know? You can allows processes/services to bind() to non-local IP addresses, which can be quite useful for application such as load balancer such as Nginx, HAProxy, keepalived, WireGuard, OpenVPN and others during boot time on Linux.

  20. Tomi Engdahl says:

    //perl and egep problem for Linux and Unix users. You may find my Regular expressions in grep ( regex ) with examples handy

  21. Tomi Engdahl says:

    //Want to see a sorted list of your top 10 directory sizes that is eating your disk space on Linux or FreeBSD/macOS? Try:

    du -sh * | sort -h | tail -10

    See or other CLI tricks or techniques to find largest top 10 files and directories on your box. #Linux #Unix #macOS #freebsd

  22. Tomi Engdahl says:

    //Yet another fancy and fantastic looking tool called duf to display statistics on free disk space in Unix, Linux, macOS, *BSD, Android, and Windows written in Golang. #Linux #macOS #unix

  23. Tomi Engdahl says:

    //Let us see how to improve your bash/sh/ksh/dash shell script with ShellCheck lint script analysis tool on Linux or FreeBSD unix system

  24. Tomi Engdahl says:

    8 tips for the Linux command line
    Take advantage of all of the powers the almighty Linux command line has to offer.

  25. Tomi Engdahl says:

    //Bash is usually the default shell on Linux desktop and used be default on macOS too. Here are useful keyboard shortcuts. More at

  26. Tomi Engdahl says:

    FYI, we can keep SSH connection alive when OpenSSH server drops you out after few minutes of inactivity

  27. Tomi Engdahl says:

    Mosh (mobile shell): Remote terminal application that allows roaming, supports intermittent connectivity and provides intelligent local echo and line editing of user keystrokes.

    Mosh is a replacement for interactive SSH terminals. It’s more robust and responsive, especially over Wi-
    Fi, cellular, and long-distance links.

    Mosh is free software, available for GNU/Linux, BSD, macOS, Solaris, Android, Chrome, and iOS.

  28. Tomi Engdahl says:

    Some Linux distros and even different kernel versions within a distro have disabled IRQ time accounting. In such case, your monitoring tools will report zero time spent in hardware interrupt handlers (shown as %hi, %irq, hiq, etc). It’s easy to check how your kernel is behaving by looking at /proc/stat and you can still measure interrupt CPU usage using perf and a little creativity.

    Is Your Linux Version Hiding Interrupt CPU Usage From You?

  29. Tomi Engdahl says:

    Suraj Kushwah’s Google-Powered Tuxi Is Like an Alexa, Cortana, or Siri for Your Terminal Window
    Tuxi the text-based assistant takes your natural language queries at the terminal and answers them using Google’s in-results infoboxes.

  30. Tomi Engdahl says:

    Linux Fu: Shell Script File Embedding

    You need to package up a bunch of files, send them somewhere, and do something with them at the destination. It isn’t an uncommon scenario. The obvious answer is to create an archive — a zip or tar file, maybe — and include a shell script that you have to tell the user to run after unpacking.

    That may be obvious, but it assumes a lot on the part of the remote user.

    They need to know how to unpack the file and they also need to know to run your magic script of commands after the unpack. However, you can easily create a shell script that contains a file — even an archive of many files — and then retrieve the file and act on it at run time. This is much simpler from the remote user’s point of view. You get one file, you execute it, and you are done.

    In theory, this isn’t that hard to do, but there are a lot of details. Shell scripts are not compiled — at least, not typically — so the shell only reads what it needs to do the work. That means if your script is careful to exit, you can add as much “garbage” to the end of it as you like. The shell will never look at it, so it’s possible to store the payload there.

    Script Doctor

    While bash scripting is often maligned and not without reason, it is very flexible and powerful, as this example shows. It is dead easy to embed files in a script and that opens up a lot of flexible options for distributing complex file setups and applications.


Leave a Comment

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