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 to monitor your Linux servers with Checkmk
    https://www.techrepublic.com/article/how-to-monitor-your-linux-servers-with-checkmk/

    Find out how to set up the powerful Checkmk monitor to keep tabs on all of your networked servers.

    Reply
  2. Tomi Engdahl says:

    jq is a Linux/Unix or macOS/*BSD CLI utility efficiently extracts data from JSON documents. Now we have an excellent htmlq utility written in Rust Lang. It is like jq but for HTML documents. https://www.cyberciti.biz/open-source/command-line-hacks/using-htmlq-to-extract-content-from-html-files-on-linux-unix/

    Reply
  3. Tomi Engdahl says:

    Did you know? You can use ‘nethogs’ that shows the bandwidth usage per *process* on #Linux. https://www.cyberciti.biz/faq/linux-find-out-what-process-is-using-bandwidth/

    Reply
  4. Tomi Engdahl says:

    Want to find your Linux distro name and version? Try universal method: cat /etc/os-release

    Another option for systemd based distros:
    hostnamectl

    The following may not work on all distros:
    lsb_release -a
    See https://www.cyberciti.biz/faq/find-opensuse-suse-enterprisel-inux-version-command/ for more info.

    Reply
  5. Tomi Engdahl says:

    How VPN works. These days I like WireGuard very much https://www.cyberciti.biz/faq/ubuntu-20-04-set-up-wireguard-vpn-server/ It is like SSH only. #Linux #unix #FreeBSD

    Reply
  6. Tomi Engdahl says:

    Let us see how to make, list snapshots for LXD and automatically expires them too on #Linux https://www.cyberciti.biz/faq/how-do-i-list-lxc-snapshots-for-lxd-on-linux/ #container #SysAdmin

    Reply
  7. Tomi Engdahl says:

    Did you know? When you exit a login Bash session/shell, you can run commands on macOS/Linux/Unix. Useful to remove bash/mysql history or run backup job so that files are backed up as soon as you exit a login shell:

    cat ~/.bash_logout

    See https://bash.cyberciti.biz/guide/.bash_logout for more info.

    Reply
  8. Tomi Engdahl says:

    Want to see a tree of processes on your #Linux and #Unix box? Try the pstree command.
    https://www.cyberciti.biz/faq/unix-linux-pstree-command-examples-shows-running-processestree/

    Reply
  9. Tomi Engdahl says:

    It is not UNIX’s job to stop you from shooting your foot. If you so choose to do so, then it is UNIX’s job to deliver Mr. Bullet to Mr Foot in the most efficient way it knows.
    https://www.cyberciti.biz/humour/terry-lambert-quote-it-is-not-unixs-job-to-stop-you/

    Reply
  10. Tomi Engdahl says:

    PS4 Emulator for Linux Now Plays Hundreds of Games
    By Michelle Ehrhardt 13 days ago
    Just Don’t expect God of War to be one of them.
    https://www.tomshardware.com/news/spine-ps4-emulator-linux-plays-hundreds-of-games

    Reply
  11. Tomi Engdahl says:

    https://www.facebook.com/126000117413375/posts/4969787616367910/
    I use my Unix laptop as server and when power goes out for an extended time i get various alert on my mobile and email https://bash.cyberciti.biz/monitoring/shell-script-to-shutdown-freebsd-laptop-when-low-on-battery-power/ Poor man’s solution :P

    Reply
  12. Tomi Engdahl says:

    Want to use ffmpeg to accelerate video encode and decode with an NVIDIA GPU on Linux? Try these tips about installing and usage the ffmpeg with NVIDIA GPU https://www.cyberciti.biz/faq/how-to-install-ffmpeg-with-nvidia-gpu-acceleration-on-linux/5

    Reply
  13. Tomi Engdahl says:

    {nixCraft Patreon supporters content} This guide explains how to use USBGuard to configure the Linux server or desktop dynamic policy to block, reject, or permit access to specific USB devices. https://www.opensourceflare.com/how-to-protect-linux-against-rogue-usb-devices-using-usbguard/

    Reply
  14. Tomi Engdahl says:

    Want to stress test your CPU and Memory On a Linux, FreeBSD or Unix-like systems? Try stress-ng https://www.cyberciti.biz/faq/stress-test-linux-unix-server-with-stress-ng/

    Reply
  15. Tomi Engdahl says:

    xRDP – Allow multiple sessions (local and remote) for the same user – HowTo
    https://c-nergy.be/blog/?p=16698

    Reply
  16. Tomi Engdahl says:

    Still have a problem checking FB or any other site due to DNS outages? Check TTL which defines how long a resolver supposed to cache the DNS query before the query expires using the dig command without visting any website as this will check your local DNS resolver typically hosted by wifi/router:
    dig +nocmd +noall +answer +ttlid A facebook.com

    Check https://www.cyberciti.biz/faq/how-to-see-time-to-live-ttl-for-a-dns-record/ detailed explanation. #Linux #macos #Unix

    Reply
  17. Tomi Engdahl says:

    {updated} how to search and remove files with one #Linux or #Unix command on fly
    https://www.cyberciti.biz/faq/linux-unix-how-to-find-and-remove-files/

    Reply
  18. Tomi Engdahl says:

    Microsoft releases Linux version of the Windows Sysmon tool https://www.bleepingcomputer.com/news/microsoft/microsoft-releases-linux-version-of-the-windows-sysmon-tool/
    Microsoft has released a Linux version of the very popular Sysmon system monitoring utility for Windows, allowing Linux administrators to monitor devices for malicious activity.

    Microsoft has released a Linux version of the very popular Sysmon system monitoring utility for Windows, allowing Linux administrators to monitor devices for malicious activity.

    For those not familiar with Sysmon (aka System Monitor), it is a Sysinternals tool that monitors a system for malicious activity and then logs any detected behavior into system log files.

    Sysmon’s versatility comes from the ability to create custom configuration files that administrators can use to monitor for specific system events that may indicate malicious activity is occurring on the system.
    https://github.com/Sysinternals/SysmonForLinux

    Reply
  19. Tomi Engdahl says:

    https://hackaday.com/2021/08/16/linux-fu-walk-chew-gum/

    If you ever think about it, computers are exceedingly stupid. Even the most powerful CPU can’t do very much. However, it can do what it does very rapidly and repeatably. Computers are so fast, they can appear to do a lot of things at once, too and modern computers have multiple CPUs to further enhance their multitasking abilities. However, we often don’t write programs or shell scripts to take advantage of this. However, there’s no reason for this, as you’ll see.

    Bash Support

    It is surprisingly easy to get multiple processes running under Bash.

    Wrap Up

    It is easy to forget that you can do more than one thing at a time pretty easily. Of course, this also opens up a whole new realm of problems. If you need to protect your programs from each other, check out our earlier post about critical sections. Not everyone thinks bash is a great programming language, but it is surprisingly capable and while it might not be good for everything, it is great for some tasks.

    https://hackaday.com/2020/08/18/linux-fu-one-at-a-time-please-critical-sections-in-bash-scripts/

    Reply
  20. Tomi Engdahl says:

    Using GNU Profiling (gprof) With ARM Cortex-M
    Learn how to profile an embedded application on ARM Cortex-M devices using GNU gprof.
    https://dzone.com/articles/using-gnu-profiling-gprof-with-arm-cortex-m

    Tutorial: Using GNU Profiling (gprof) with ARM Cortex-M
    https://mcuoneclipse.com/2015/08/23/tutorial-using-gnu-profiling-gprof-with-arm-cortex-m/

    Reply
  21. Tomi Engdahl says:

    IPv6 bridge and IPv4 router (NAT) shell script for OpenWRT
    https://github.com/cvmiller/v6brouter

    Reply
  22. Tomi Engdahl says:

    The du command for #Unix was written on November 3, 1971. It is 50 years ago. Almost as old as me lmao. Happy birthday du command. https://www.cyberciti.biz/faq/unix-disk-usage-command-examples/ I like duf more https://www.cyberciti.biz/open-source/command-line-hacks/duf-disk-usage-free-utility-for-linux-bsd-macos-windows/ but some prefer to use the ncdu on #Linux https://www.cyberciti.biz/open-source/install-ncdu-on-linux-unix-ncurses-disk-usage/ What do you prefer to use on your Unix/macOS/Linux system?

    Reply
  23. Tomi Engdahl says:

    HowTo: Linux Check Password Strength With Cracklib-check Command
    Author: Vivek Gite
    https://www.cyberciti.biz/security/linux-password-strength-checker/

    Reply
  24. Tomi Engdahl says:

    Here is a pro tip: Learn how to get pretty ‘syntax’ highlighting with using the diff command to compare file line-by-line on your #Linux, #macOS and #Unix like systems.
    https://www.cyberciti.biz/programming/color-terminal-highlighter-for-diff-files/

    Reply
  25. Tomi Engdahl says:

    {updated} How To Use grep Command In Linux / UNIX With Practical Examples https://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/

    Reply
  26. Tomi Engdahl says:

    Did you know? You can generate random bonsai (盆栽) trees on your Linux and Unix system for fun https://www.cyberciti.biz/open-source/cbonsai-linux-bonsai-tree-generator-for-cli-lovers-for-fun/ Try it out.

    Reply
  27. Tomi Engdahl says:

    Did you know? Man pages on Linux and Unix-like systems such as macOS/*BSD don’t have to be dull black and white. You can get color output in the console when using the man command:

    export MANPAGER=”less -R –use-color -Dd+r -Du+b”
    man bash

    See https://bash.cyberciti.biz/guide/Man_command#Color_output_in_the_console for info.

    Reply
  28. Tomi Engdahl says:

    OpenSSH is critical for #Linux and #Unix servers including desktop systems such as macOS or WSL. However, misconfig can create issues. But fear not, you can audit the SSH server and client config easily. You don’t have to be a security guru for that. New developers and sysadmins can look for security and other issues. https://www.cyberciti.biz/tips/how-to-audit-ssh-server-and-client-config-on-linux-unix.html

    Reply

Leave a Comment

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

*

*