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/

638 Comments

  1. Tomi Engdahl says:

    {Updated} How to set up MariaDB Master Slave replication with SSL on Ubuntu Linux 22.04 LTS. Tested with the latest MariaDB version 10.10 https://www.cyberciti.biz/faq/how-to-set-up-mariadb-master-slave-replication-with-ssl-on-ubuntu-linux/

    Reply
  2. Tomi Engdahl says:

    How to test and validate DNSSEC using dig command line under Linux, macOS, and Unix https://www.cyberciti.biz/faq/unix-linux-test-and-validate-dnssec-using-dig-command-line/

    Reply
  3. Tomi Engdahl says:

    The $ character is used for parameter expansion, arithmetic expansion and command substitution. You can use it for manipulating and expanding variables on demands without using external commands such as perl, python, sed or awk. This guide shows you how to use parameter expansion modifiers to transform Bash shell variables for your scripting needs. https://www.cyberciti.biz/tips/bash-shell-parameter-substitution-2.html

    Reply
  4. Tomi Engdahl says:

    Bash aliases are mainly used to abbreviate a system command or add default arguments to a regularly used command. Here is how to ignore aliases and function if the need arises https://www.cyberciti.biz/faq/ignore-shell-aliases-functions-when-running-command/ #Linux #programming

    Reply
  5. Tomi Engdahl says:

    Everything is compatible with Linux if you WINE hard enough

    tiss

    Reply
  6. Tomi Engdahl says:

    How a faithful fellow Linux or Unix user removes the grep command while grepping the ps command outputs. See https://www.cyberciti.biz/tips/grepping-ps-output-without-getting-grep.html for more info. #Linux #linuxadministrator #programming

    Reply
  7. Tomi Engdahl says:

    This is fine. My disk is fine
    See how to monitor SSD/PCIe nvme/hard disks temperature on Linux https://www.cyberciti.biz/tips/howto-monitor-hard-drive-temperature.html for more info.

    Reply
  8. Tomi Engdahl says:

    This page explains time command in Linux and Unix-like system with most common examples. https://www.cyberciti.biz/faq/unix-linux-time-command-examples-usage-syntax/

    Reply
  9. Tomi Engdahl says:

    7 Linux commands to gather information about your system
    Get information about your CPU, storage, RAM, BIOS, and more without leaving the terminal.
    https://www.redhat.com/sysadmin/linux-system-info-commands

    Reply
  10. Tomi Engdahl says:

    21 Examples To Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
    https://www.cyberciti.biz/tips/check-unix-linux-configuration-file-for-syntax-errors.html

    Reply
  11. Tomi Engdahl says:

    How to make an automatic dog feeder with Arduino and Linux
    Try this DIY project to learn (or teach your family) to write code that interfaces with real hardware.
    https://www.redhat.com/sysadmin/linux-arduino-automatic-dog-feeder

    Reply
  12. Tomi Engdahl says:

    Manage your Linux environment for success
    A guide to modern best practices, tools, and techniques for effective system management
    https://www.redhat.com/en/engage/linux-management-ebook-s-201912231121

    Reply
  13. Tomi Engdahl says:

    this is what happens when you don’t know about ssh Proxy and Jump commands on your Linux/Unix systems ;) https://www.cyberciti.biz/faq/linux-unix-ssh-proxycommand-passing-through-one-host-gateway-server/

    Reply
  14. Tomi Engdahl says:

    Want to display animated Christmas tree in your Linux, macOS, Unix and BSD Terminal? Try these simple tips https://www.cyberciti.biz/open-source/command-line-hacks/linux-unix-desktop-fun-christmas-tree-for-your-terminal/

    Reply
  15. Tomi Engdahl says:

    Linux Fu: Miller The Killer Makes CSV No Pest
    https://hackaday.com/2022/12/28/linux-fu-miller-the-killer-makes-csv-no-pest/

    Historically, one of the nice things about Unix and Linux is that everything is a file, and files are just sequences of characters. Of course, modern practice is that everything is not a file, and there is a proliferation of files with some imposed structure. However, if you’ve ever worked on old systems where your file access was by the block, you’ll appreciate the Unix-like files. Classic tools like awk, sed, and grep work with this idea. Files are just characters. But this sometimes has its problems. That’s the motivation behind a tool called Miller, and I think it deserves more attention because, for certain tasks, it is a lifesaver.
    The Problem

    Consider trying to process a comma-delimited file, known as a CSV file. There are a lot of variations to this type of file.

    https://github.com/johnkerl/miller

    Reply
  16. Tomi Engdahl says:

    I run a multi-user system with ssh. How can I stop leaking process information to all users on Linux? How do I prevent users from seeing processes that do not belong to them on a Linux when running ps/top? Here is how to hide process from other Linux users https://www.cyberciti.biz/faq/linux-hide-processes-from-other-users/

    Reply
  17. Tomi Engdahl says:

    How to analyze a Linux process’ memory map with pmap
    Use the pmap command to explore how a process is mapped in memory to monitor or troubleshoot memory usage.
    https://www.redhat.com/sysadmin/pmap-command

    Reply
  18. Tomi Engdahl says:

    Most modern desktop and laptop comes with Windows 8 or 10 keys embedded in BIOS. Thinkpad, Dell, and many other BIOS vendors expose these keys to Linux, too, along with tons of data. So one can find and retrieve Windows 10/11 or Windows 8 key using Linux. https://www.cyberciti.biz/faq/linux-find-windows-10-oem-product-key-command/

    Reply
  19. Tomi Engdahl says:

    Did you know? You can temporarily use a subshell, move to a different working directory and do your work without affecting the rest of the operations. For example:
    “`
    cmd1
    (cd /jobs/ && cmd2 )
    cmd2
    “`
    See https://bash.cyberciti.biz/guide/What_is_a_Subshell%3F for more info and examples for Linux and Unix.

    Reply
  20. Tomi Engdahl says:

    Top 22 sysadmin guides and tutorials of 2022
    Enable Sysadmin’s top articles of the year include a lot of Linux commands, automation tips, container strategies, troubleshooting, and more.
    https://www.redhat.com/sysadmin/enable-sysadmin-guides-2022

    Reply
  21. Tomi Engdahl says:

    Imagine typing ssh user@SOME_IP in the terminal and being able to get ANYTHING on the other side: a Python script, a limited shell or root access into another computer. Here is how!

    https://www.youtube.com/watch?v=5WiI9CptdSk

    Reply
  22. Tomi Engdahl says:

    How to create and use file access control lists in Linux
    Simplify your life by using ACLs to assign specific permissions for users or groups.
    https://www.redhat.com/sysadmin/access-control-lists

    Reply
  23. Tomi Engdahl says:

    Trinity uses nmap in The Matrix movie. To learn how to use Nmap for offensive and defensive purposes on #Linux, #macOS/#BSD or #Unix-like systems https://www.cyberciti.biz/security/nmap-command-examples-tutorials/

    Reply
  24. Tomi Engdahl says:

    Ubuntu 20.04 set up WireGuard VPN server https://www.cyberciti.biz/faq/ubuntu-20-04-set-up-wireguard-vpn-server/ #Linux #linuxadministrator

    Reply
  25. Tomi Engdahl says:

    SheepShaver: A Cross-Platform Tool For Retro Enthusiasts
    https://hackaday.com/2023/03/24/sheepshaver-a-cross-platform-tool-for-retro-enthusiasts/

    The world of desktop computing has coalesced into what is essentially a duopoly, with Windows machines making up the bulk of the market share and Apple carving out a dedicated minority. This relatively stable state hasn’t always existed, though, as the computing scene even as late as the 90s was awash with all kinds of competing operating systems and various incompatible hardware. Amiga, Unix, OS/2, MacOS, NeXT, BeOS, as well as competing DOSes, were all on the table at various points.

    If you’ve still got a box running one of these retro systems, SheepShaver might be able to help expand your software library. It’s not the sort of virtualization that we’re used to in the modern world, with an entire operating system running on a sanctioned-off part of your system. But SheepShaver does allow you to run software written for MacOS 7.5.2 thru 9.0.4 in a different environment. Unix and Linux are both supported, as well as Mac OS X, Windows NT, 2000, and XP, and the enigmatic BeOS. Certain configurations allow applications to run natively without any emulation at all, and there is plenty of hardware support built-in as well.

    https://sheepshaver.cebix.net/

    SheepShaver is a MacOS run-time environment for BeOS and Linux that allows you to run classic MacOS applications inside the BeOS/Linux multitasking environment. This means that both BeOS/Linux and MacOS applications can run at the same time (usually in a window on the BeOS/Linux desktop) and data can be exchanged between them. If you are using a PowerPC-based system, applications will run at native speed (i.e. with no emulation involved). There is also a built-in PowerPC emulator for non-PowerPC systems.

    Reply
  26. Tomi Engdahl says:

    Executing Python Scripts With a Shebang
    https://realpython.com/python-shebang/

    When you read someone else’s Python code, you frequently see a mysterious line, which always appears at the top of the file, starting with the distinctive shebang (#!) sequence. It looks like a not-so-useful comment, but other than that, it doesn’t resemble anything else you’ve learned about Python, making you wonder what that is and why it’s there. As if that wasn’t enough to confuse you, the shebang line only appears in some Python modules.

    What’s a Shebang, and When Should You Use It?
    In short, a shebang is a special kind of comment that you may include in your source code to tell the operating system’s shell where to find the interpreter for the rest of the file:

    #!/usr/bin/python3

    print(“Hello, World!”)

    If you’re using a shebang, it appear on the first line in your script, and it has to start with a hash sign (#) followed by an exclamation mark (!), colloquially known as the bang, hence the name shebang.

    Reply
  27. Tomi Engdahl says:

    Linux Fu: Gum Up Your Script
    https://hackaday.com/2023/03/29/linux-fu-gum-up-your-script/

    We often write quick bash scripts and judging by the comments, half of us use bash or a similar shell to pop out quick, useful scripts, and half of us think that’s an abomination, and you should only use bash for your command line and resort to something more like a traditional language to do anything else. If you’re in the former camp, you’re probably cursing your allegiance when you need to make your bash scripts more interactive.

    Gum can help. It’s a utility that can handle your script input and output with a little flair while requiring almost no effort on your part.

    https://github.com/charmbracelet/gum

    Reply
  28. Tomi Engdahl says:

    “Stop using Telnet to test ports
    Make life simpler by automating network checks with tools like Expect, Bash, Netcat, and Nmap instead.”

    Stop using Telnet to test ports
    https://www.redhat.com/sysadmin/stop-using-telnet-test-port

    Make life simpler by automating network checks with tools like Expect, Bash, Netcat, and Nmap instead.

    Reply

Leave a Comment

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

*

*