0% found this document useful (0 votes)
43 views

Linux Command Line Cheat Sheet

Uploaded by

Ajay 19cse003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Linux Command Line Cheat Sheet

Uploaded by

Ajay 19cse003
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

OverAPI.

com Python jQuery NodeJS PHP Java Ruby Javascript ActionScript CSS Express More » Search

Resource Bash Bash Bash IO


Online Commands Shortcuts Variables Redirection
Official Website
uname -a CTRL-c env cmd < file
Download Show system and kernel Stop current command Show enviro-nment variables Input of cmd from file
Linux Command Line Tips head -n1 /etc/issue CTRL-z echo $NAME cmd1 <(cmd2
Unix/Linux Command Cheat Sh Show distri-bution Sleep program Output value of $NAME variabl Output of cmd2 as file input to c
eet [.pdf] mount CTRL-a e md1
Linux Administrator's Quick Ref Show mounted filesy-stems Go to start of line export NAME-=v-alue cmd > file
erence [.pdf] date CTRL-e Set $NAME to value Standard output (stdout) of cmd
Command Line Interface Comm Show system date Go to end of line $PATH to file
ands [.jpg] uptime CTRL-u Executable search path cmd
Show uptime Cut from start of line $HOME Discard stdout of cmd
Related whoami CTRL-k Home directory cmd >> file
chmod Show your username Cut to end of line $SHELL Append stdout to file
Debian man command CTRL-r Current shell cmd 2> file
Fedora Show manual for command Search history Error output (stderr) of cmd to fil
Red Hat !! e
Ubuntu Repeat last command cmd >&2
Unix !abc stdout to same place as stderr
Run last command starting with Pipes cmd 2>&1
Command abc
!abc:p Anchros
stderr to same place as stdout
cmd &> file

Directory Lists Print last command starting with


abc
cmd1 | cmd2
stdout of cmd1 to cmd2
Every output of cmd to file

!$
Operations cmd1 ; cmd2
Run cmd1 then cmd2 Last argument of previous com
cmd1 |& cmd2
stderr of cmd1 to cmd2
mand
pwd cmd1 && cmd2
Show current directory
Run cmd2 if cmd1 is successful
ALT-.
Last argument of previous com ls Options
mkdir dir cmd1 || cmd2 mand
Run cmd2 if cmd1 is not succes
!* -a
Make directory dir
cd dir
sful
cmd All arguments of previous com Search Files -R
Show all (including hidden)
Change directory to dir mand
cd ..
Run cmd in a subshell
^abc-^-123 grep pattern files Recursive list
Go up a directory Run previous command, replaci
Search for pattern in files -r
ls ng abc with 123 grep -i Reverse order
List files
Case insens-itive search -t
grep -r Sort by last modified
File Recursive search
grep -v
-S
Sort by file size
Operations Inverted search -l
Nano touch file1
Process grep -o
Show matched part of file only -1
Long listing format

Shortcuts Create file1


cat file1 file2
Management find /dir/ -name name*
Find files starting with name in -m
One file per line

Concat-enate files and output ps dir Comma--sep-arated output


Files less file1 Show snapshot of processes find /dir/ -user name -Q
Ctrl-R View and paginate file1 top Find files owned by name in dir Quoted output
Read file file file1 find /dir/ -mmin num
Show real time processes
Ctrl-O Get type of file1 kill pid Find files modifed less than nu
Save file cp file1 file2 m minutes ago in dir
Kill process with id pid
Ctrl-X Copy file1 to file2 pkill name whereis command
Close file mv file1 file2
Move file1 to file2
Kill process with name name
killall name
Find binary / source / manual fo
r command Screen
Images locate file
ALT-A
rm file1
Delete file1
Kill all processes with names be
ginning name Find file (quick search of syste Shortcuts
Start marking text head file1 m index)
CTRL-K screen
Show first 10 lines of file1 Start a screen session.
Cut marked text or line tail file1
CTRL-U screen -r
Show last 10 lines of file1 Resume a screen session.
Paste text tail -f file1
Output last lines of file1 as it ch
File screen -list
Navigate File Show your current screen sessi
ALT-/
anges Permissions ons.
End of file CTRL-A
4 Activate commands for screen.
CTRL-A read (r)
Beginning of line CTRL-A c
2 Create a new instance of termin
CTRL-E write (w) al.
End of line
1 CTRL-A n
CTRL-C execute (x) Go to the next instance of termi
Show line number
chmod 644 file nal.
CTRL-_ Change mode of file to rw-r--r-- CTRL-A p
Go to line number
chmod -R 750 folder Go to the previous instance of t
Recursively chmod folder and c erminal.
Search File ontents to rwxr-x--- CTRL-A "
CTRL-W chown usr:grp file Show current instances of termi
Find Change file owner to usr, and gr nals.
ALT-W oup to grp CTRL-A A
Find next Rename the current instance.
CTRL-\
Search and replace

You might also like