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:

    //While Pi-Hole is excellent, there is another option to block ads and malware using DNS. Let us see how to install a DNSCrypt proxy for your whole network to encrypt DNS traffic between clients and resolver on Linux along with an adblocker/malware blocker.
    https://www.cyberciti.biz/faq/how-to-install-dnscrypt-proxy-with-adblocker-on-linux/

    Reply
  2. Tomi Engdahl says:

    //Let us see how to find dropped packets stats on Linux and tools that we can use to find out why a Linux server is dropping packets?
    https://www.cyberciti.biz/faq/linux-show-dropped-packets-per-interface-command/

    Reply
  3. Tomi Engdahl says:

    Here is how to get yesterday’s or tomorrow’s (or any other date) in bash on Linux or Unix (FreeBSD/macOS)
    https://www.cyberciti.biz/tips/linux-unix-get-yesterdays-tomorrows-date.html

    Reply
  4. Tomi Engdahl says:

    //how to configure OPNsense (FreeBSD based opensource Unix firewall) with DNS Over TLS (DoT) to increase your privacy and security.
    https://www.dnsknowledge.com/unbound/opnsense-set-up-and-configure-dns-over-tls-dot/

    Reply
  5. Tomi Engdahl says:

    // Learn how to issue Let’s Encrypt wildcard certificate with acme sh and Cloudflare DNS on Linux or Unix system https://www.cyberciti.biz/faq/issue-lets-encrypt-wildcard-certificate-with-acme-sh-and-cloudflare-dns/

    Reply
  6. Tomi Engdahl says:

    //Keep (don’t delete) input files during compression or decompression when using gzip/gunzip on a Linux or Unix like systems:

    ls -l filename
    gzip -k filename
    gunzip –keep input_file_name

    See https://www.cyberciti.biz/faq/how-to-gzip-and-keep-original-file-on-unix-or-linux-command-line/

    Reply
  7. Tomi Engdahl says:

    //Enjoy the mysteries of the sea from the safety of your own Linux or Unix terminal! https://www.cyberciti.biz/tips/linux-unix-apple-osx-terminal-ascii-aquarium.html

    Reply
  8. Tomi Engdahl says:

    //Want to delete LXD based container with lxc command on Linux? Try these simple tips https://www.cyberciti.biz/faq/delete-container-with-lxc-lxd-command-on-linux/

    Reply
  9. Tomi Engdahl says:

    Expired TLS/SSL certificates can cause downtime and confusion for end-users. Hence, it is crucial to monitor the expiry date for our TLS/SSL certificates. Let us see how to find out TLS/SSL cert expiry date from the Linux/Unix CLI and write a simple script to alert developers/sysadmin. https://www.cyberciti.biz/faq/find-check-tls-ssl-certificate-expiry-date-from-linux-unix/

    Reply
  10. Tomi Engdahl says:

    //Let us see how to perform shell script analysis on Linux or Unix. Useful to enhance your shell scripts, avoid errors and productivity https://www.cyberciti.biz/programming/improve-your-bashsh-shell-script-with-shellcheck-lint-script-analysis-tool/

    Reply
  11. Tomi Engdahl says:

    //Here is how to add network bridge to your Ubuntu Linux desktop or server using the nmcli. Useful for your Docker, LXD, KVM and other VM stuff. https://www.cyberciti.biz/faq/ubuntu-20-04-add-network-bridge-br0-with-nmcli-command/

    Reply
  12. Tomi Engdahl says:

    //Quick tutorial about how to install VirtualBox on Ubuntu 20.04 Linux LTS system https://www.cyberciti.biz/faq/how-to-install-virtualbox-on-ubuntu-20-04-linux-lts/

    Reply
  13. Tomi Engdahl says:

    // {Updated} Learn how to customize and colorize your bash prompt on a Linux, macOS/*BSD or Unix-like systems https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/

    Reply
  14. Tomi Engdahl says:

    //UFW is an acronym for an uncomplicated firewall. Securing a network with an uncomplicated firewall is super easy and highly recommended. It allows you to protect the server from bad guys, and you can open or close ports, ban IP addresses and limit ssh access and much more quickly. Let us see how to set up and use ufw on Ubuntu 20.04 LTS server. https://www.cyberciti.biz/faq/how-to-configure-firewall-with-ufw-on-ubuntu-20-04-lts/

    Reply
  15. Tomi Engdahl says:

    Try this: /sbin/ldconfig -NXv
    That should print the state of the ld_library cache without rebuilding it.

    Reply
  16. Tomi Engdahl says:

    Missing /etc/rc.local support on major Linux distros? Fear not. We can easily enable rc.local shell script support on systemd while booting the Linux system. https://www.cyberciti.biz/faq/how-to-enable-rc-local-shell-script-on-systemd-while-booting-linux-system/

    Reply
  17. Tomi Engdahl says:

    //{Updated} Bash while loop examples for Linux and Unix users https://www.cyberciti.biz/faq/bash-while-loop/

    Reply
  18. Tomi Engdahl says:

    Linux Jargon Buster: What are GUI, CLI and TUI in Linux?
    https://itsfoss.com/gui-cli-tui/

    Reply
  19. Tomi Engdahl says:

    Magnificent app which corrects your previous console command.
    https://github.com/nvbn/thefuck

    Reply
  20. Tomi Engdahl says:

    //Boss: How do I check which shell I am using?

    More about commands here https://www.cyberciti.biz/tips/how-do-i-find-out-what-shell-im-using.html

    Reply
  21. Tomi Engdahl says:

    AutoKey: How to Replace Characters with Predefined Text Automatically in Linux
    https://www.cloudsavvyit.com/7870/autokey-how-to-replace-characters-with-predefined-text-automatically-in-linux/

    Welcome to AutoKey, the free desktop automation utility for Linux. Do you often use templates, repeat keystrokes or other repetitive tasks? If so, AutoKey is a great toolkit you do not want to miss out on!

    What is AutoKey?
    Let’s say you often type your email address, or your postal address. It can be a bit frustrating to have to type it out every time. Let AutoKey do it for you! All you have to do is to associate a keyboard shortcut – a set of keystroke events – with a particular blurb of text.

    Reply
  22. Tomi Engdahl says:

    Can someone advise me on how to lock ssh to specific computer ? E. G so only one computer can access server ubuntu

    for a while i used a preshared key and disabled passwords alltogether

    Two step process.
    Step 1: use pre-shared key so password is not required to ssh from a particular account.
    https://www.redhat.com/sysadmin/passwordless-ssh
    Step 2: disable ssh password login
    https://www.cyberciti.biz/faq/how-to-disable-ssh-password-login-on-linux/
    You would need to physically access the local terminal at the server if you get locked out, or install a secure KVM.

    Reply
  23. Tomi Engdahl says:

    //Want to see max args and other limits for your shell on Linux and Unix environment (https://cyberciti.biz/faq/linux-list-all-environment-variables-env-command/) variables? Try:

    false | xargs –show-limits

    getconf -a |grep MAX

    Reply
  24. Tomi Engdahl says:

    //No need to install a VMware workstation or VirtualBox on Ubuntu for your VM needs. You can use KVM, which is far superior and directly built-into the Linux kernel. Learn how to install KVM on Ubuntu 20.04 LTS headless Linux server https://www.cyberciti.biz/faq/how-to-install-kvm-on-ubuntu-20-04-lts-headless-server/

    Reply
  25. Tomi Engdahl says:

    Interesting thread and shell scripting commends. Running a command in each folder without affecting subfolders https://www.nixcraft.com/t/running-a-command-in-each-folder-without-affecting-subfolders/3610

    Reply
  26. Tomi Engdahl says:

    The Linux System Information Tool inxi
    https://www.cloudsavvyit.com/8123/the-linux-system-information-tool-inxi/

    inxi, the free and open source command line based system information tool, can provide you with a plethora of hardware & software information, in a modular and efficient output format. Ideal for end users, and DevOps, support or QA engineers.

    What Is inxi ?
    The inxi manual defines inxi as a ‘Command line system information script for console and IRC’. Highly efficient (fast), detailed, and modular, inxi provides yo with the details about any area of your computer you would like to inspect or explore.

    This may be of much interest to users who have just bought new hardware (or a completely new system) and would like to explore how the operating system sees the hardware. DevOps engineers may also be interested in using inxi when managing remote servers in the cloud, to explore their capabilities and to see whether the hardware they paid for is actually present.

    Reply
  27. Tomi Engdahl says:

    How to use the Linux mtr command
    mtr is an essential, real-time network diagnostic tool for your sysadmin toolbox.
    https://www.redhat.com/sysadmin/linux-mtr-command

    As a Linux sysadmin, you know that the general consensus is to blame every problem on infrastructure, which is your realm. Network engineers, our arch nemeses (kidding), always tell us that, “It’s not a network problem.” I really hate hearing those words because it means that now the focus is on me, my operating systems, and my hardware. Rather than rely on the word of my sworn enemy (kidding again) to tell me where the problem is, I can proactively investigate the network for myself. The mtr utility allows me to do it without bothering anyone else or getting stewed during an all-hands, troubleshooting conference call. The mtr command is a simple but effective network analysis and troubleshooting tool. This brief introduction will get you started.

    The following description is from the mtr command’s package information.

    Mtr is a network diagnostic tool that combines ping and traceroute into one program. Mtr provides two interfaces: an ncurses interface, useful for using Mtr from a telnet* session; and a GTK+ interface for X (provided in the mtr-gtk package).

    *Obviously, this description is somewhat outdated. Replace ‘telnet’ with SSH.

    Why mtr?
    You might wonder why I’m writing about a utility called My Traceroute (mtr) when there is traceroute, ping, netstat, ip, and other tools lying around that can help with troubleshooting network connectivity. Well, mtr is a little different. It is analogous to the top command in that it refreshes on its own and gives you a live look at network response and connectivity.

    Reply
  28. Tomi Engdahl says:

    //Linux hostnamectl command and options cheat sheet. See https://www.cyberciti.biz/faq/ubuntu-20-04-lts-change-hostname-permanently/ for more examples.

    Reply
  29. Tomi Engdahl says:

    //Where security is critical, we use strong encryption such as Pretty Good Privacy/GNU PGP instead of the relatively weak standard encryption provided by many CLI utilities. Let us see how to encrypt and decrypt files on Linux and Unix command-line. https://www.cyberciti.biz/tips/linux-how-to-encrypt-and-decrypt-files-with-a-password.html

    Reply
  30. Tomi Engdahl says:

    Did you know? You can colorized ip command output on Linux and make it easier to read on screen:

    ip -c command
    ip -c route
    ip -c link

    See our guide https://www.cyberciti.biz/faq/linux-ip-command-examples-usage-syntax/ for more info.

    Reply
  31. Tomi Engdahl says:

    //An open-source guide to help you write better command-line programs, taking traditional UNIX principles and updating them for the modern day. https://clig.dev/ #Linux #Programming

    Reply
  32. Tomi Engdahl says:

    //Learn 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/ #Linux #Sysadmin #programming

    Reply
  33. Tomi Engdahl says:

    //How to check TLS/SSL certificate expiration date from your Linux, macOS, *BSD or Unix-like command-line https://www.cyberciti.biz/faq/find-check-tls-ssl-certificate-expiry-date-from-linux-unix/

    Reply
  34. Tomi Engdahl says:

    //In bash there is an environment variable that allows you to customize your prompt, including colors. I personally like to have different colors for the current user/hostname, info from git, and the current directory. Here is a page with details: https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/ #linux #Unix #SysAdmin #programming

    Reply
  35. Tomi Engdahl says:

    //Explains how to make a superuser (admin) with root-like access to the MySQL or MariaDB databases with secure plugins. Further, learn how to create an encrypted file to store admin user/password, host, and TLS info securely for ease of login via Linux/Unix CLI. https://www.cyberciti.biz/faq/how-to-create-mysql-admin-user-superuser-account/ #SysAdmin #programming #Linux #Unix #MySQL #DBA

    Reply
  36. Tomi Engdahl says:

    The free ride is over, guys. CentOS Linux 8, as a rebuild of RHEL 8, will end at the end of 2021. https://www.cyberciti.biz/linux-news/centos-linux-8-will-end-in-2021-and-shifts-focus-to-centos-stream/ #Linux #Sysadmin #IT

    Reply
  37. Tomi Engdahl says:

    Beautifully done. Try to explain Linux shell ls command in short. https://www.reddit.com/r/linux/comments/k9dsn3/try_to_explain_linux_shell_ls_command_in_short/ #Linux #Unix #programming #devops

    Reply

Leave a Comment

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

*

*