The following is a list of various Bash commands which I use on a regular basis. It's not exhaustive, just a simple "getting started", and collection of useful commands. Anything between the brackets "<>" should be replaced.
Collection of various Bash commands:
- Bash One-liners
- Bash Scripting Cheatsheet
- apt-get aptitude cheatsheet
- aws cli cheatsheet
- postgres cheatsheet
lsls -latouch <file_name>mv <file_name> <new_file_name>cp <file_name> <file_name>rm -f <file_name>cat <file_name>less <file_name>head -<n_lines> <file_name>tail -<n_lines> <file_name>locate <file_name>which <program_name>find . -type f -print0 | xargs -0 grep "<search_string>"pwdls -d */cd <directory_name>cd ~mkdir <folder_name>mv <folder_name> <new_folder_name>rmdir <folder_name>ls -lachmod +x <file_name>chown -R <user_name> <folder_name>printenvexport VAR_NAME="hello"echo $VAR_NAMEunset VAR_NAMEchmod +x ./script_name.shfind ./ -name "*.sh" -exec chmod +x {} \;./script_name.sh. ./script_name.sh
source ./script_name.sh@see http://www.artificialworlds.net/blog/2012/10/17/bash-associative-array-examples/ifconfig -aip link showsudo /etc/init.d/dns-cleansudo service network-manager restartsudo netstat -tunlp
nmap <127.0.0.1 | localhost | ip_addr>sudo netstat -tunlp | grep <port_number>nmap -sP 192.168.1.1/24
nmap -sP <ip_addr>/<ip_mask># custom TCP SYN scan
sudo nmap -sP -PS22,3389 192.168.1.1/24
sudo nmap -sP -PS<port_1>,<port_2> <ip_addr>/<ip_mask>
#custom UDP scan
sudo nmap -sP -PU161 192.168.1.1/24
sudo nmap -sP -PU<port_1> <ip_addr>/<ip_mask>ssh <user_name>@<host_name>ssh -p <port_number> <user_name>@<host_name>ssh -i <identity_filename> <user_name>@<host_name>ssh-keygen -R <server_dns> > /dev/null 2>&1;scp <user_name>@<server_dns>:<remote_location> <local_location>http://www.haifux.org/lectures/86-sil/kernel-modules-drivers/kernel-modules-drivers.html
lspcilsmod