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/

643 Comments

  1. Tomi Engdahl says:

    How can I run a command called foo, and have it timeout/abort after 10 seconds under GNU/Linux running bash shell or script? How do I run the command under an alarm clock? https://www.cyberciti.biz/faq/shell-scripting-run-command-under-alarmclock/

    Reply
  2. Tomi Engdahl says:

    CentOS Linux 8.1 (1911), derived from Red Hat Enterprise Linux 8.1 Source Code released. Happy upgrades!

    https://www.cyberciti.biz/linux-news/centos-linux-8-x-released-and-here-is-how-to-upgrade-it/

    #sysadmin #opensource #linux

    Reply
  3. Tomi Engdahl says:

    Many Linux user dual boot Linux with Windows 10/8.1 or wipe out install Linux. However, sometimes you need Windows 10, and here is how to find out your original Windows 10 OEM product key using Linux for various reasons. https://www.cyberciti.biz/faq/linux-find-windows-10-oem-product-key-command/ #sysadmin #IT

    Reply
  4. Tomi Engdahl says:

    Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000:

    php -S 127.0.0.1:8000

    python3 -m http.server 8000

    python2 -m SimpleHTTPServer 8000

    ruby -run -ehttpd . -p8000

    https://gist.github.com/willurd/5720255

    Reply
  5. Tomi Engdahl says:

    perl -MIO::All -e ‘io(“:8080″)->fork->accept->(sub { $_[0] < io(-x $1 ? "./$1 |" : $1) if /^GET \/(.*) / })' # multiforking CGI & static server in one line of Perl

    Reply
  6. Tomi Engdahl says:

    Writing Safe Shell Scripts https://www.cyberciti.biz/rd/20.php #Unix #Linux #BashShell

    Reply
  7. Tomi Engdahl says:

    How to use parallel ssh (PSSH) for executing ssh in parallel on a number of Linux/Unix/BSD servers

    https://www.cyberciti.biz/cloud-computing/how-to-use-pssh-parallel-ssh-program-on-linux-unix/

    Reply
  8. Tomi Engdahl says:

    Bash For Loop Examples
    https://www.cyberciti.biz/faq/bash-for-loop/

    How do I use bash for loop to repeat certain task under Linux / UNIX operating system? How do I set infinite loops using for statement? How do I use three-parameter for loop control expression?

    Reply
  9. Tomi Engdahl says:

    {Updated} How to list / view various cron jobs on your Linux or Unix-based system. Now explains how to list jobs from systemd.timer under modern Linux distros too ;) https://www.cyberciti.biz/faq/linux-show-what-cron-jobs-are-setup/

    Reply
  10. Tomi Engdahl says:

    [Update] 25 Outstanding Backup Utilities for Linux Systems in 2020

    https://www.tecmint.com/linux-system-backup-tools/

    Reply
  11. Tomi Engdahl says:

    If you are configuring a high available load-balancer using Nginx/HAProxy, you need to set up non-local addresses option for IP failover to work. This page explains how to allow Linux processes to bind to an IP address that doesn’t exist yet. https://www.cyberciti.biz/faq/linux-bind-ip-that-doesnt-exist-with-net-ipv4-ip_nonlocal_bind/ #sysadmin

    Reply
  12. Tomi Engdahl says:

    htop explained
    Explanation of everything you can see in htop/top on Linux
    https://peteris.rocks/blog/htop/

    Reply
  13. Tomi Engdahl says:

    As you may know, Linux retired ‘netstat’ and replaced with ‘ss’ command.

    https://www.cyberciti.biz/tips/linux-investigate-sockets-network-connections.html

    Reply
  14. Tomi Engdahl says:

    port of OpenBSD’s doas(1) utility to Linux systems.
    https://github.com/multiplexd/doas

    Reply
  15. Tomi Engdahl says:

    eXtern OS – A NodeJS Based Linux Distribution
    https://www.tecmint.com/externos-nodejs-based-linux-distribution/

    eXternOS is a free, new and exciting Linux operating system based on Nodejs, being developed by a computer engineering and computer science student who goes by name Anesu Chiodze.

    It is powered by NW.js which has full support for Node.js APIs and most if not all third-party modules–bringing about limitless possibilities of app development, without looking elsewhere. It brings a new dimension to building native applications with modern web technologies such as HTML5, CSS3, WebGL and more.

    In addition, it ships in with highly tweaked and dedicated software for video and audio playback, and a web browser fully compatible with the latest web technologies.

    https://externos.io/

    Reply
  16. Tomi Engdahl says:

    Introducing the virt-what and other command for Linux environments that try to detect if it runs on a physical machine or on a virtualized one. https://www.cyberciti.biz/faq/linux-determine-virtualization-technology-command/

    Reply
  17. Tomi Engdahl says:

    How to append text to a file when using sudo command on Linux or Unix
    https://www.cyberciti.biz/faq/sudo-append-data-text-to-file-on-linux-unix-macos/

    Reply
  18. Tomi Engdahl says:

    The growth of command line options, 1979-Present
    https://danluu.com/cli-complexity/

    We can see that the number of command line options has dramatically increased over time

    Ironically, one of the reasons for the rise in the number of command line options is another McIlroy dictum, “Write programs to handle text streams, because that is a universal interface”

    Reply
  19. Tomi Engdahl says:

    Linux Kernel Teaching
    https://linux-kernel-labs.github.io/refs/heads/master/index.html

    This is a collection of lectures and labs Linux kernel topics. The lectures focus on theoretical and Linux kernel exploration.

    The labs focus on device drivers topics and they resemble “howto” style documentation.

    Reply
  20. Tomi Engdahl says:

    Debug bash script:
    bash -x script

    Or in the script itself:
    #!/bin/bash -x

    The debugging output goes to stderr when pass the -x. If you would like to log it to a file (mylog) add two line top of the script:
    #!/bin/bash
    exec 2>> /path/to/mylog
    set -x
    # rest of your script goes here

    Reply
  21. Tomi Engdahl says:

    This page explains how to boost your Linux server’s Internet speed with TCP BBR configurations. https://www.cyberciti.biz/cloud-computing/increase-your-linux-server-internet-speed-with-tcp-bbr-congestion-control/

    Reply
  22. Tomi Engdahl says:

    Linux Fu: Tracing System Calls
    https://hackaday.com/2020/04/07/linux-fu-tracing-system-calls/

    But if you tell strace to run it, the command becomes:

    strace ln -sf testxmit.grc /tmp

    You might want to redirect the output to a file using the shell or the -o option, though. Some commands generate a lot and often the first page or two of output isn’t really what you care about anyway.

    Reply

Leave a Comment

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

*

*