Show Menu

Basic linux commands

bash commands

uname -a
Show system and kernel info
Show system date
System uptime
Show current user
Show mounted filesy­stems
Show manual for command

bash variables

Show enviro­nment variables
echo "­STR­ING­"
Output string
echo $NAME
Output value of NAME variable
export NAME = value
set "­value to NAME
Executable search path
Home directory
Current shell

directory operations

Shows present working directory
mkdir dirname
Make directory
cd dirname
Change directory
cd ..
Go to parent directory of current dir
list files

ls options

Long list
Show all(hidden files too)
Recursive order
Reverse order
Sort by last modified
Comma separated output
Quoted output
Sort by file size

file search methods

grep pattern files
Search for patter in files
grep -r
Recursive search
grep -i
Case insens­itive search
grep -v
Inverted search
find /dir/ -name name
Find files starting with name in dir
find /dir/ -user name
Find files owned by name in dir
locate file
Find file

file operations

touch file1
create file1
cat file1 file2
concat­enate file and output
file file1
get type of file1
cp file1 file2
Copy file1 to file2
mv file1 file2
Move file1 to file2
rm file1
Delete file1
head file1
show top 10 lines of file1
tail file1
show bottom 10 lines of file1

IO redire­ction

command < file
read input of command from file
command > file
write output to file
command >> file
Append output to file
command1 | command2
Pipe operator to output of command 1 to command 2

process management

show processes
show real time processes
kill pid
Kill process with id pid
pkill name
Kill process with name name
killall name
kill all processes with name name

file permis­sions

chown user:group file
Change file owner to user and group to group
chmod 777 file
Change mode of file to 777
The first digit is owner permis­sion,
the second is group and third is user

bash shortcuts

CTRL - c
Stop current comand
CTRL - z
Sleep program
CTRL - a
Go to start
CTRL - e
Go to end
CTRL - r
search history
repeat last command
run last command starting with abc
last argument of previous command
all arguments of previous command


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Pocket Guide LINUX commands Cheat Sheet
          Common Commands Cheat Sheet
          Command Line and Terminal navigation Cheat Sheet