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:
Want to find out available auth methods for remote sshd on Linux/Unix? Try
s=box1
u=vivek
timeout 8 ssh -v ${u}@${s} true 2>&1 \
| egrep “Authenticating to|Authentications that can continue”
Make sure you disable ssh pass login to increase security. See https://www.cyberciti.biz/faq/linux-run-a-command-with-a-time-limit/
Tomi Engdahl says:
Learn how to set/change server’s Fully Qualified Domain Name (FQDN) on Ubuntu 20.04 LTS “Focal Fossa” Linux https://www.cyberciti.biz/faq/how-to-set-change-fqdn-on-ubuntu-20-04-linux/
Tomi Engdahl says:
Did you know you can kill an unresponsive ssh session from your Linux or macOS or Unix/*BSD desktop using the following tricks? No need to close terminal:
First hit [Enter] key to start a new escape sequence
Then press ~ (tilde)
And finally, type . (dot)
Tomi Engdahl says:
I/O redirection for both bash and POSIX shell to write data to the file under Linux or Unix-like systems. See https://www.cyberciti.biz/faq/how-to-write-the-output-into-the-file-in-linux/
Tomi Engdahl says:
Learn how to make LUKS (Linux Unified Key Setup, disk encryption) header backup and restore it in case of urgency or misconfiguration.
https://www.cyberciti.biz/security/how-to-backup-and-restore-luks-header-on-linux/
#Linux #OpenSource
Tomi Engdahl says:
Are you missing less command on your CentOS/RHEL/Fedora Linux cloud server? Here is how to install it manually using CLI or bundle with your Docker/Podman based Linux container using Dockerfile https://www.cyberciti.biz/faq/how-to-install-less-on-centos-rhel-fedora/
Tomi Engdahl says:
Forgot privilege escalation on Linux or Unix while running a command that needs root-level access? Do not type the whole command again. Simply type:
sudo !!
## OR ##
sudo !-1
!! or !-1 is a bash history feature that refers to the previous command. #OpenSource
Tomi Engdahl says:
Want to find out an IP address of Linux KVM guest from Linux host itself? Try these methods.
https://www.cyberciti.biz/faq/find-ip-address-of-linux-kvm-guest-virtual-machine/
Tomi Engdahl says:
Learn various commands for iptables firewall rules that can be stored permanently on Debian/Ubuntu/RHEL/Centos Linux server or desktop.
https://www.cyberciti.biz/faq/how-to-save-iptables-firewall-rules-permanently-on-linux/
#Linux #OpenSource
Tomi Engdahl says:
BASH Prepend A Text / Lines To a File
https://www.cyberciti.biz/faq/bash-prepend-text-lines-to-file/
#Linux #Unix #OpenSource
Tomi Engdahl says:
How to install and setup PostgreSQL on RHEL (Red Hat Enterprise Linux) 8 server https://www.cyberciti.biz/faq/install-and-setup-postgresql-on-rhel-8/
Tomi Engdahl says:
telemetry domains. DNS level block list. You can find such lists on Github and other pages for your personal or office usage. Or install pi-hole https://cyberciti.biz/faq/ubuntu-linux-install-pi-hole-with-a-openvpn/ on your Debian/Ubuntu/CentOS home server.
Tomi Engdahl says:
How to Check if a String Contains a Substring in Bash https://www.cyberciti.biz/faq/bash-find-out-if-variable-contains-substring/ #Linux
Tomi Engdahl says:
Want to show and count all open files and list the top 10 processes on #Linux or Unix? Try:
lsof | awk ‘{print $1}’ | sort | uniq -c | sort -r | head
See my page for more tips https://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/
Tomi Engdahl says:
Learn how to view the status of a service on #Linux using systemctl for debugging purposes.
https://www.cyberciti.biz/faq/systemd-systemctl-view-status-of-a-service-on-linux/
Tomi Engdahl says:
Quick and dirty way to find out remote ssh server version using #Linux, macOS or Unix desktop with bash only:
timeout 1 cat </dev/tcp/ip_addr/22
timeout 1 cat </dev/tcp/192.168.2.236/22
timeout 1 cat </dev/tcp/localhost/22
You need bash v2.04+ and must be compiled with networking support. Hiding OpenSSH/sshd version is not important. Instead of that, make sure you patch your system on time, including OpenSSH, disable root login, enable ssh keys based login, 2FA and more. See OpenSSH security best practices https://www.cyberciti.biz/tips/linux-unix-bsd-openssh-server-best-practices.html guide.
Tomi Engdahl says:
for i in /proc/[0-9]*; do cmd=$(cat $i/cmdline|tr ” ‘ ‘) a=( $i/fd/* ); echo “${#a[*]} $cmd”; done|sort -nrk1|head -n10
Tomi Engdahl says:
https://staaldraad.github.io/2017/12/20/netstat-without-netstat/ on extreme cases, am I right?
Tomi Engdahl says:
Ubuntu Linux 20.04 set up WireGuard VPN server https://www.cyberciti.biz/faq/ubuntu-20-04-set-up-wireguard-vpn-server/
Tomi Engdahl says:
https://www.cyberciti.biz/faq/linux-find-dell-service-tag-command/
Tomi Engdahl says:
Advance your Linux skills with these 3 command line primers
You can’t rely on a GUI forever. Instead, check out these helpful Linux guides on how to manage users and servers with the command line.
https://www.techrepublic.com/article/advance-your-linux-skills-with-these-3-command-line-primers/
Tomi Engdahl says:
Want to find out hard disk drive specs under Linux? Try these commands
https://www.cyberciti.biz/faq/find-hard-disk-hardware-specs-on-linux/
Tomi Engdahl says:
Eyecandy + bashtop = Awesome Linux system resource monitoring tool
https://www.cyberciti.biz/open-source/command-line-hacks/bashtop-awesome-linux-resource-monitor-tool/
Tomi Engdahl says:
Learn how to keep your CentOS 8 Community Enterprise Linux server or desktop secure by installing security updates on time.
https://www.cyberciti.biz/faq/centos-8-update-installed-packages-for-security/
Tomi Engdahl says:
//Pro tip: If possible, always avoid white spaces and special characters in your filenames. It will save so many headaches and time when scripting common tasks on your Linux or Unix boxes. Exhibit A.
TL;DR; always use camel case or under score.
A well written script should be able to deal with the broad range of allowed symbols. Always. Otherwise you have very propably a serious security problem.
But you should create your files in a way to make it easier to handle them.
Tomi Engdahl says:
and don’t use & ” ‘ ; etc
Tomi Engdahl says:
//Kotlin is an open source, statically typed, programming language running on the JVM. It can also be compiled to Javascript source code. Let us see how to install Kotlin on an Ubuntu or Debian Linux dev system. https://www.cyberciti.biz/faq/how-to-install-kotlin-programming-language-on-ubuntudebian-linux/
Tomi Engdahl says:
// Learn how to check if your Linux system is 32-bit or 64-bit
https://www.cyberciti.biz/faq/how-do-i-know-if-my-linux-is-32-bit-or-64-bit/
Tomi Engdahl says:
// Did you know we can create a Linux swap file to optimize server configuration or immediately increase swap space? Useful for desktop/laptop users for hibernation too.
https://www.cyberciti.biz/faq/how-to-create-a-linux-swap-file/
Tomi Engdahl says:
Learn how to protect your CentOS 8 OpenSSH (sshd) server with Fail2Ban
https://www.cyberciti.biz/faq/how-to-protect-ssh-with-fail2ban-on-centos-8/
Tomi Engdahl says:
// Quick and easy way to enable NTP on RHEL or CentOS/Fedora Linux:https://www.nixcraft.com/t/how-do-i-check-linux-systems-current-ntp-configuration/3519/2
Tomi Engdahl says:
// This tutorial explains how to install different versions of Java (OpenJDK) on Ubuntu Linux 20.04 LTS and manage them using the CLI. Once Java is installed, we can write an application or install tomcat etc. https://www.cyberciti.biz/faq/install-java-on-ubuntu-20-04-linux/
Tomi Engdahl says:
The Unix timestamp will begin with 16 this Sunday. Let us run simple while loop to see this on your screen (poor man’s count down):
tput clear; while :; do tput cup 10 10; date +%s; sleep 1; done
Tomi Engdahl says:
// Here is a pro tip to create a temporary and disposable email from your Linux and Unix/macOS terminal. https://www.cyberciti.biz/open-source/command-line-hacks/tmpmail-temporary-email-right-from-linux-unix-bash-shell/
Tomi Engdahl says:
//Learn how to find and delete a directory recursively on Linux or Unix-like system. Useful for removing older directories or backups after 30 dayshttps://www.cyberciti.biz/faq/how-to-find-and-delete-directory-recursively-on-linux-or-unix-like-system/
Tomi Engdahl says:
// Want to see firewalld dropped or rejected firewall log on your CentOS/RHEL/SUSE/OpenSUSE Linux server? Try these tips to enable a separate log file using rsyslogd. https://www.cyberciti.biz/faq/enable-firewalld-logging-for-denied-packets-on-linux/
Tomi Engdahl says:
Pro tip: Here is how to kill your unresponsive hung ssh session without killing your terminal app.
https://www.cyberciti.biz/faq/openssh-linux-unix-osx-kill-hung-ssh-session/
Tomi Engdahl says:
Linux / Unix acronym of the day:
dd = Disk Destroyer.
Tomi Engdahl says:
// well that escalated quickly https://www.cyberciti.biz/faq/howto-use-grep-command-in-linux-unix/
Tomi Engdahl says:
https://hackaday.com/2020/08/03/linux-fu-help-messages-for-shell-scripts-and-here-documents/
Tomi Engdahl says:
https://hackaday.com/2020/08/25/linux-fu-your-own-dynamic-dns/
Tomi Engdahl says:
https://hackaday.com/2020/06/29/linux-fu-parallel-universe/
Tomi Engdahl says:
https://hackaday.com/2020/08/08/a-shell-a-programming-language-relax-its-both/
Tomi Engdahl says:
//Quick tip: Display banner/message before OpenSSH authentication on your Linux and Unix boxeshttps://www.cyberciti.biz/howto/quick-tip-display-banner-message-before-openssh-authentication/
Tomi Engdahl says:
curl cheat sheet for Linux and Unix users. large version https://daniel.haxx.se/blog/wp-content/uploads/2020/01/sticker-cheat-sheet.png
Tomi Engdahl says:
https://hackaday.com/2020/09/29/linux-fu-making-awk-a-bit-easier/
Tomi Engdahl says:
//Want to manage Linux firewall rules on the LXD bridge manually? Here is how to disable NAT and firewall rules on the LXD bridge
https://www.cyberciti.biz/faq/how-to-disable-firewall-and-nat-rules-on-the-lxd-bridge/
Tomi Engdahl says:
Various dd CLI option to show status bar while making copy https://www.cyberciti.biz/faq/linux-unix-dd-command-show-progress-while-coping/
Tomi Engdahl says:
Learn how to check which shell am I using on Linux or Unix https://www.cyberciti.biz/tips/how-do-i-find-out-what-shell-im-using.html
Tomi Engdahl says:
// Alpine Linux is a systemd free Linux distro that comes with OpenRC. Let us see how to set up WireGuard VPN and SNAT using Awall firewall to route traffic via our VPN client. https://www.cyberciti.biz/faq/how-to-set-up-wireguard-vpn-server-on-alpine-linux/