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
ls
ls -la
touch <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>"
pwd
ls -d */
cd <directory_name>
cd ~
mkdir <folder_name>
mv <folder_name> <new_folder_name>
rmdir <folder_name>
ls -la
chmod +x <file_name>
chown -R <user_name> <folder_name>
printenv
export VAR_NAME="hello"
echo $VAR_NAME
unset VAR_NAME
chmod +x ./script_name.sh
find ./ -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 -a
ip link show
sudo /etc/init.d/dns-clean
sudo service network-manager restart
sudo 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
lspci
lsmod