$ lsb_release -a;
$ cat /etc/os-release;
$ cat /etc/issue;
$ hostnamectl;
$ls; #Prefix command with backslash
$command ls; #Use ‘command’ utility
$/bin/ls; #Use absolute path
$“ls”; #Quote the command
$unalias ls ; #Temporarily unalias that command
$type pwd; # Use ‘type’ to find out what the program does. Helpful to find out the alias commands.
$alias; # Display all the custom aliases.
$compgen -c | grep -x . | sort -u; # List all the single character linux commands.
$type -m ‘?’; # Similar to above ‘compgen’ command but for zsh.
$type -a ls; # To troubleshoot what is happening with the ls command.
nohup : no hang up. nice: the priority of the process is called nice value. default is 10.
$nohup htop &; # (1) Using nohup.
$nohup nice htop &; # nice: run program in lower priority.
$((htop &)&); # (2) Using double fork.
$Ctrl+z # moving the current program in background.
$fg; # Bring background job to foreground. ie reverse of ^z .
$sleep 10 &; # sleeps for 10 seconds.
$jobs; # List all the background running jobs.
$sudo nohup htop > nohup_log.log &; # Redirecting the nohup output to nohup_log.log file rather than the default nohup.log file.
$nohup bash -c 'mkdir files &&ping -c 1 google.com && ls'> output.txt; # Running multiple process in background using nohup.
$kill -9 $(pgrep –a htop); # Killing a process using PID.
Usages:
zathura book.pdf & ; disown; #works
zathura book.pdf >/dev/null 2>&1 & disown; #works
$brew install $(brew search font | grep -i nerd | tr '\n' ' ');
Clear terminal window (5 ways): clear, reset, ^L, printf "\ec", printf "\x1Bc"
$ps -o pid,pgid,tty,etime,comm | grep zsh; # pgid: process group id.
$echo $(ps -ef | grep gunicorn | awk '{print $2}' | sort | uniq | egrep -v '^1$') | xargs kill;
$ps -9 <pid>; # Get program name from it’s pid.
# <defunct> # zombie processes, already killed.
if [ -f ~/.config/commons/bash_aliases ]; then
. ~/.config/commons/bash_aliases
fi
# [[ ! -f ~/.config/commons/bash_aliases ]] || source ~/.config/commons/bash_aliases # Alternative
$echo $_ ; echo !$ ; # Last argument of previous command.
$echo !! ; # Last command.
$ vim /etc/pam.d/common-password
# Note: comment out all the lines in this file and add the following lines at the EOF.
password [success=1 default=ignore] pam_unix.so minlen=1 sha512
password requisite pam_deny.so
password required pam_permit.so
password optional pam_gnome_keyring.so