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/
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://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
Tomi Engdahl says:
Awesome feature added by OpenBSD. crontab now supports random numbers https://marc.info/?l=openbsd-cvs&m=158691599313802&w=2
We need this feature ported to other Linux/Unix version of crontab.
Tomi Engdahl says:
Bash shell script pro tip add the following after shebang to catch and avoid unwanted errors/side effects:
set -euo pipefail
-e : stop script after 1st cmd failed
-u : exit when 1st unset variable found
-o pipefail : exit after 1st piped commands failed
See https://bash.cyberciti.biz/guide/Set_command
Tomi Engdahl says:
I prefer the more verbose variant
set – o errexit
set – o nounset
set – o pipefail
Tomi Engdahl says:
How to test and validate DNSSEC using dig command line
https://www.cyberciti.biz/faq/how-to-see-time-to-live-ttl-for-a-dns-record/
Tomi Engdahl says:
Fun from nixcraft
https://m.facebook.com/story.php?story_fbid=3397583100255044&id=12600011741337
$ sudo systemctl restart 2020
Failed to restart 2020.service
$ sudo systemctl stop 2020
Failed to stop 2020.service
$ sudo killall -9 2020
2020: process cannot be killed by root (0)
$ sudo systemctl status 2020
2020: It is not a bug, it is a feature.
$ sudo systemctl reboot
2020: A lockdown job is waiting in background … reboot of economy and society will have to wait till kernel module named vaccine loaded in the background.
Tomi Engdahl says:
Quick tutorial for new users: How to change hostname on Ubuntu Linux 20.04 LTS
https://www.cyberciti.biz/faq/how-to-change-hostname-on-ubuntu-20-04/
Tomi Engdahl says:
How to save terminal output to a file under Linux/Unix
https://www.cyberciti.biz/faq/how-to-save-terminal-output-to-a-file-under-linux-unix/
How do I save the terminal output to a file when using BASH/KSH/CSH/TCSH under Linux, macOS, *BSD or Unix-like operating systems?
Tomi Engdahl says:
This quick tutorial explains how to find/list all failed systemd services/units on Linux operating systems using the systemctl command.
https://www.cyberciti.biz/faq/systemd-systemctl-list-all-failed-units-services-on-linux/
#opensource #linux #sysadmin #IT
Tomi Engdahl says:
How do I find out running processes were associated with each open port on Linux?
https://www.cyberciti.biz/faq/what-process-has-open-linux-port/
Tomi Engdahl says:
lsof -i
OR
netstat -antp
netstat is deprecated. ss is its new reincarnation
ss can filter without adding grep in the mix:
# ss -tul ‘( sport = :3306 )’
Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port
tcp LISTEN 0 128 *:3306 *:*
Tomi Engdahl says:
https://www.cyberciti.biz/faq/ubuntu-20-04-set-up-wireguard-vpn-server/
Tomi Engdahl says:
https://www.cyberciti.biz/tips/ubuntu-linux-view-the-status-of-my-network-interfacescard.html
Tomi Engdahl says:
https://www.cyberciti.biz/faq/linux-copy-clone-usb-stick-including-partitions/
Tomi Engdahl says:
Linux uninstall package / software using the CLI
https://www.cyberciti.biz/faq/linux-uninstall-package-software-using-the-cli/
Tomi Engdahl says:
10 Tools To Add Some Spice To Your UNIX/Linux Shell Scripts
https://www.cyberciti.biz/tips/spice-up-your-unix-linux-shell-scripts.html
Tomi Engdahl says:
{new user shell tip} Learn how to remove the last character from the line or shell variable using sed command on Linux/Unix.
https://www.cyberciti.biz/faq/sed-remove-last-character-from-each-line/
#sysadmin #programming #opensource #scripting
Tomi Engdahl says:
Linux copy and clone USB stick including partitions command
https://www.cyberciti.biz/faq/linux-copy-clone-usb-stick-including-partitions/
Tomi Engdahl says:
https://www.cyberciti.biz/faq/linux-remove-delete-symbolic-softlink-command/
Tomi Engdahl says:
As you know, WireGuard recently becomes a stable release & now part of the official Linux kernel. It is an alternative to OpenVPN with the clean codebase. Learn how to set up WireGuard VPN on Debian 10 server with a firewall from backports.
https://www.cyberciti.biz/faq/debian-10-set-up-wireguard-vpn-server/
#opensource
Tomi Engdahl says:
Welcome to The Practical Linux Hardening Guide wiki!
https://github.com/trimstray/the-practical-linux-hardening-guide/wiki
Tomi Engdahl says:
https://hackbuddy.in/hacking-tricks/termux-hacks-complete-guide-all-you-need-to-know/
Tomi Engdahl says:
TMUX FOR MERE MORTALS
https://zserge.com/posts/tmux/
Tmux has liberated me from tiling window mangers. Not that I didn’t like those, but I occasionally have to work with macOS or default GNOME setups. And over the years I realised that I only need a terminal multiplexor to do terminal tiling for me, the rest of the windows are just fine to be full-screen in separate workspaces.
So, I ended up doing 80% of my work in terminals with tmux.
Tomi Engdahl says:
Linux Command Line Productivity With Tmux
https://hackaday.com/2020/05/01/linux-command-line-productivity-with-tmux/
Tomi Engdahl says:
The purpose of this guide is to introduce a user to the Nmap command line tool to scan a host or network to find out the possible vulnerable points in the hosts. You will also learn how to use Nmap for offensive and defensive purposes https://www.cyberciti.biz/security/nmap-command-examples-tutorials/ #security #infosec
Tomi Engdahl says:
In this tutorial, we explains how to add and create a Linux Network Bridge on CentoS 8 Linux server for virtualization or Linux containers.
https://www.cyberciti.biz/faq/centos-8-add-network-bridge-br0-with-nmcli-command/
#opensource #linux #KVM #Docker #LXD
Tomi Engdahl says:
Quickly create dirs pattern. Less typing and more work
mkdir -vp /etc/tinc/mdb{1..3}_vpn0
mkdir -vp /etc/tinc/mdb{1..3}_vpn0/host{1..3}
Works with many other commands.
Tomi Engdahl says:
bat command is a cat(1) command clone with syntax highlighting and Git integration written in Rust lang. Let us see how to install bat on Linux, macOS, FreeBSD and Unix-like system for fun and profit.
https://www.cyberciti.biz/open-source/bat-linux-command-a-cat-clone-with-written-in-rust/
#OpenSource
Tomi Engdahl says:
The state of the AWK
https://lwn.net/SubscriberLink/820829/5bf9bf8bb9d6f2bf/
Tomi Engdahl says:
https://www.cyberciti.biz/faq/linux-unix-bash-check-interactive-shell/
Tomi Engdahl says:
https://www.cyberciti.biz/tips/linux-unix-pause-command.html
Tomi Engdahl says:
https://www.cyberciti.biz/faq/how-to-check-how-long-a-process-has-been-running/
How do I check how long a process or pid has been running on my Ubuntu/Debian or CentOS Linux server?
You need to use the ps command to see information about a selection of the active processes. The pid command provide following two formatting options for a PID (process identification number).
How to check how long a process has been running?
You need to pass the -o etimes or -o etime to the ps command. The syntax is:
ps -p {PID-HERE} -o etime
ps -p {PID-HERE} -o etimes
Tomi Engdahl says:
https://www.cyberciti.biz/faq/how-to-enable-and-install-epel-repo-on-centos-8-x/
Tomi Engdahl says:
https://www.cyberciti.biz/faq/how-to-add-install-man-pages-on-ubuntu-linux/
Tomi Engdahl says:
https://www.cyberciti.biz/faq/grep-regular-expressions/
Tomi Engdahl says:
Explains various Linux command line tricks to find ulimit values of currently running processes such as Nginx, PHP, MySQL, and users. https://www.cyberciti.biz/faq/how-to-find-ulimit-for-user-on-linux/ #opensource #sysadmin #IT
Tomi Engdahl says:
Sending a hex string to a remote via netcathttps://stackoverflow.com/questions/43919867/sending-a-hex-string-to-a-remote-via-netcat
how to transmit binary/hex data to the remote device.
You can do it with command: echo -n -e “\x02\x45\x31\x38\x03\x34\x43\x0d\x0a” | nc [-u]
The -n supresses outputting the trailing newline.
The -e enables the interpretation of backslash escapes -> allowing usto send hex codes.’x’ before each character specifies that the byte is in hexadecimal form.
-u switch to UDP traffic (optional)
Tomi Engdahl says:
https://www.tecmint.com/reset-forgotten-root-password-in-ubuntu/
Tomi Engdahl says:
https://www.smarthomebeginner.com/run-pihole-in-docker-on-ubuntu-with-reverse-proxy/
Tomi Engdahl says:
sudo apt install food medicine
sudo apt reinstall oldjob salarybump
sudo apt –purge remove covid19 recession
E: Could not find package oldjob
Tomi Engdahl says:
https://www.cyberciti.biz/faq/delete-command-from-history-linux-unix-osx-bash-shell/
Tomi Engdahl says:
Exit command: . Let us see how to use the exit command and the exit statuses in our scripts or at the CLI.
https://bash.cyberciti.biz/guide/Exit_command
Tomi Engdahl says:
Learn how to configure road warrior WireGuard VPN with NAT (Network Address Translation), which allow @WireGuardVPN [WireGuard] clients to access the Internet from home or public WiFi securely.
https://www.cyberciti.biz/faq/how-to-set-up-wireguard-firewall-rules-in-linux/
#sysadmin #networking #security #ubuntu #debian #centos
Tomi Engdahl says:
https://www.cyberciti.biz/faq/redirecting-stderr-to-stdout/
Tomi Engdahl says:
The beauty of Unix pipelines
https://prithu.xyz/posts/unix-pipeline/
Tomi Engdahl says:
Sure way to ruin your Linux box by calling Daemons from the past:
source .bash_history
Tomi Engdahl says:
https://www.facebook.com/126000117413375/posts/3566246583388694/
ssh and scp command have different option to specifies the port to connect to on the remote host and it drives me crazy so much on my Linux desktop.
scp -P {PORT} file user@server: # CAPITAL P
ssh -p {PORT} user@server # small p
Tomi Engdahl says:
https://hackaday.com/2020/04/07/linux-fu-tracing-system-calls/
Tomi Engdahl says:
Linux Fu: Tracing System Calls
https://hackaday.com/2020/04/07/linux-fu-tracing-system-calls/
Tomi Engdahl says:
Sweet Streams Are Made Of These: Creating Music On The Command Line
https://hackaday.com/2020/03/19/sweet-streams-are-made-of-these-creating-music-on-the-command-line/
Tomi Engdahl says:
https://hackaday.com/2020/04/24/debugging-for-sed-no-kidding/