Linux cheatsheet

1 minute read

TODO

  • Add other if needed

Bash

Shotcut to use the Bash more effective

Shotcut detail
Moving  
Ctrl + a Move to begin of line
Ctrl + e Move to end of line
Ctrl + b Move back one char
Ctrl + f Move forward 1 char
Alt + B skip one word backward
Alt + F skip one word forward
Alt + D Delete 1 word
Delete  
Ctrl + d delete the right part of cusor
Ctrl + h delete the left part of cusor
Copy + Paste  
Ctrl + u cut the right part of cusor
Ctrl + k cut the left part of cusor
Ctrl + k paste
Screen  
Ctrl + l clear current screen
History  
Ctrl + p go back history
Ctrl + n go next history
Ctrl + r search history

Process

Shotcut detail  
ps aux List processes  
bg List processes  
fg List processes  
nohup ./script.sh 2>&1 tee output.log & Run in bg + can logout + save output
nohup ./script.sh > /dev/null 2>&1 & Run in bg + can logout + discard output  

Networking

Shotcut detail
ping ip/domain ping command
traceroute ip/domain tracerout
netstate network’s data
ss socket data
dig nslookup
ip ip command
ip neighbor arp table
arp arp table
tcpdump -i NIC monitor NIC
iptables rule for networking
nmap ip show port status
ethtool -S NIC check network data for NIC

There’s a useful list at link

Trick

Shotcut detail
sudo !! run last command with sudo
ctrl+x+e open editor to run command
fc edit command with editor
disown -a && exit exit terminal + leave all process running

# tunnel with ssh
# local port 3337 -> remove host's 127.0.0.1 on port 6379
# very usefull when working with cloud
ssh -L 3337:127.0.0.1:6379 root@emkc.org -N

Performance tuning

Great list at linuxperf

Leave a comment