SS Bash - Linux CL Cheatsheet
SS Bash - Linux CL Cheatsheet
uname -a Show system and export NAME=value Set $NAME to value cmd1 ; cmd2
kernel | Run cmd1 then cmd2
cmd &
uptime Show uptime | Run cmd in a subshell
IO Redirection
whoami Show your username
cmd < file Directory Operations
man command Show manual for command | Input of cmd from file
pwd Show current directory
cmd1 <(cmd2)
| Output of cmd2 as file input to cmd1
mkdir dir Make directory dir
Bash Shortcuts
cmd > file
cd dir Change directory to dir
CTRL-c Stop current command | Standard output (stdout) of cmd to file
cd .. Go up a directory
cmd > /dev/null
CTRL-z Sleep program
| Discard stdout of cmd
ls List files
chown user:group file find /dir/ -name name* Find files starting with
echo $NAME Output value of $NAME variable
| Change file owner to user and group to group name in dir
Linux Command Line Cheat Sheet
Search Files (cont) Process Management Screen Shortcuts (cont)
find /dir/ -user name Find files owned by name in ps Show snapshot of processes screen
dir | Start a screen session
top Show real time processes
find /dir/ -mmin num Find files modified less than
num minutes ago in dir screen -r
kill pid Kill process with id pid
| Resume a screen session.
whereis command Find binary / source / pkill name Kill process with name name
manual for command
screen -list
killall name Kill all processes with names | Show your current screen sessions.
locate file Find file (quick search of beginning name
system index)
CTRL-A
Nano Shortcuts | Activate commands for screen.
File Operations
Files
CTRL-A c
touch file1 | Create a new instance of terminal.
| Create file1 Ctrl-R Read file
less file1
Cut and Paste CTRL-A p
| View and paginate file1
| Go to the previous instance of terminal.
ALT-A Start marking text
file file1
| Get type of file1 CTRL-A "
CTRL-K Cut marked text or line | Show current instances of terminals.
cp file1 file2
| Copy file1 to file2 CTRL-U Paste text
CTRL-A A
Navigate File | Rename the current instance.
mv file1 file2
| Move file1 to file2
ALT-/ End of file
More screen info at:
rm file1 http://www.gnu.org/software/screen/
| Delete file1 CTRL-A Beginning of line
4 read (r)
ALT-W Find next
Watch a Command
CTRL-\ Search and replace 2 write (w)
watch -n 5 'ntpq -p'
| Issue the 'ntpq -p' command every 5
| seconds and display output More nano info at: 1 execute (x)
http://www.nano-editor.org/docs.php