Linux Commands Cheatsheet is a list of all the commands used in Linux operating system. I’ve seen many people find it difficult to operate on a Linux Desktop or any Linux based operating system which uses certain sets of commands to be written on the terminal for any operation.
I was certainly a Windows user but when I started building my projects with Raspberry Pi, I too find it difficult to operate on the Debian based operating system which I’ve installed on my Raspberry Pi i.e., Raspbian.

After which I decided to learn Linux commands and in a few weeks I fell in love with the Linux environment. I highly recommend you to use Linux command cheatsheet if you’re a developer or want to be a computer master-mind. So here are some basic command line that would be enough for learning and getting started with Linux using Linux command Cheatsheet.


Note: Hold option (alt) and click a position in the current line to move your cursor to that position.

Clear history: ctrl + l

Clear everything left from current cursor position: ctrl + u

Clear everything right from current cursor position: ctrl + k

Re-call last input with sudo: sudo !!

Stop current process: ctrl + c

Jump to left: ctrl + a

Jump to right: ctrl + e

Help: help cd / help dir (…)

Finding Help: apropos directory / apropos search (…)

Define custom startup screen: sudo nano /etc/motd

Run a script as background process: python &

List all running process’s: ps aux

Kill a running process: sudo kill 12345


Get the current path: pwd

Copy to clipboard: pwd | pbcopy

Paste: pbpaste

Get the current hostname: hostname

Get the current users: users

Get all info about the environment: env

Show calendar: cal

Show today’s date: date

Exit terminal: exit


Use -R option to change permissions recursively.

List: ps -ef | grep apache | grep -v grep

Change permissions: chmod 755 index.php

Change owner: chown root index.php (root is the username)

Change group: chgrp www-data index.php (www-data is the groupname)

WordPress Files/Folder Permissions

Let apache be owner: chown www-data:www-data -R *

Change directory permissions rwxr-xr-x: find . -type d -exec chmod 755 {} ;

Change file permissions rw-r–r–: find . -type f -exec chmod 644 {} ;



List directory contents: ls

List all directory contents: ll

List all directory contents sorted by time edited: ls -alt

List directory (wildcard matching): ls *.txt

List all files of type: find . -name "*.txt" -print

Go back to previous directory: cd -

Make (empty) directory: mkdir sample-dirname

Remove (empty) directory: rmdir sample-dirname

Remove directory with all contents: rm -rf sample-dirname/

Remove directory contents and keep directory: rm -rf *

Checkout directory: cd sample-dirname

Browsing directories: pushd sample-dirname / popd / dirs (see


Create symlink: ln -s source-dirname destination-dirname

Update symlink: ln -sfn source-dirname destination-dirname

Remove symlink: unlink sample-dirname

  • -s: Create a symbolic link.
  • -f: If the target file already exists, then unlink it.
  • -F: If the target file already exists and is a directory, then remove/overwrite it.
  • -h: If the target file or directory is a symbolic link, do not follow it.
  • -n: Same as -h, for compatibility with other ln implementations.


Make (empty) file: touch sample-filename.txt

Change creation date: touch –t 201401011337 sample-filename.txt

Change modified date: touch –mt 201401011337 sample-filename.txt

Duplicate file: cp sample-filename.txt sample-filename-copy.txt

Copy/Page folder with content: cp -a folder/ new_folder

Move/Rename file: mv current-filename.txt new-filename.txt

Move/Rename file and prompt before overwriting an existing file: mv -i current-filename.txt new-filename.txt

Remove file: rm sample-filename.txt

View file: less sample-filename.txt / more sample-filename.txt

Write to file (will overwrite existing content): cat > sample-filename.txt (quit with ctrl+d)

Search for a filename (not content!) in the current directory: find sample-filename.txt

Search for a string (not filename!) inside all files in the current directory: ack "string" --php (documentation)

Search for a string inside all files in the current directory and subdrectories: grep -r "string" *

Search and replace within file: sed -i '' 's/original-text/new-text/g' sample-filename.txt

MD5 hash for files: md5 sample-filename.txt

MD5 hash for folders: tar c folder | md5sum

Encrypt file: openssl enc -aes-256-cbc -e -in sample-filename.txt -out sample-encrypted.txt

Decrypt file: openssl enc -aes-256-cbc -d -in sample-encrypted.txt -out sample-filename.txt


Access via ssh: ssh pi@

Copy file from server to local: scp pi@ ~/Desktop/ (use -r to recursively get complete folder)

Copy file from local to server: scp ~/Desktop/file.png pi@ (use -r to recursively get complete folder)

Copy file from local to server: rsync --exclude=".DS_Store" -vzcrSLh ~/Desktop/file.png pi@

Escape files with spaces in name like this: /path/to/file name.png


Show disc space: df -h

Show disc space (inodes): df -i

Show disc space for current directory: du -hs

Current processes (also CPS usage): top or htop

Show running php processes: ps aux | grep php

Monitor error log (stream as file grows): tail error.log -f -n 0


Start appliction: open -a [name-of-programm] e.g. open -a firefox

Open finder with current folder: open .


Register variable: export TESTING="Sample Text"

Echo variable: echo $TESTING

Unset variable: unset TESTING

Output & RedirectsWrite to file: echo "Hello" > hello.txt

Append content from a file to another file: cat file1.txt >> file2.txt

Add the amount of lines, words, and characters to file2.txt: cat file1.txt | wc | cat > file2.txt

Sort the content of a file (like cat): sort hello.txt

Save to sorted content to a new file: cat file1.txt | sort > sorted-file1.txt

Sort and remove duplicates and save to a new file: sort file1.txt | uniq > uniq-file1.txt


Calculate (returns only int): echo $((123/2))


Check site feedback: ping

Show site IP: dig +short

Show A Record: dig a (Returns: aka public-name ttl internet record-type server-address)


Curl headers: curl -I



Installation: brew install tree


Installation: brew install httpie


http GET https://hofmannsven.test --verify=no


Fix OpenSSH Client Bug:

Nano CLI Basics

Jump to end of file: ctrl + w + v

Vim CLI Basics

Related tutorial



Custom config: ~/.vimrc

Color schemes



Insert mode: i

Command mode: ESC

Navigation: h, j, k, l

Move to next word: w (combine with the number to skip words)

Move to the beginning of word: b (combine with the number to skip words)

Move to end of the word: e (combine with the number to skip words)

Insert three dashes: 3i-

Jump to next dash: f-

Jump to the third dash: 3f-

Jump to next bracket: %

Jump to the beginning of line: 0

Jump to end of the line: $

Jump to the next occurrence of a word: *

Jump to previous occurrence of a word: #

Jump to the beginning of the file: gg

Jump to end of the file: G

Browser current working directory: :e . (allows browsing and searching with /)

Search word: / (Use n and N to navigate)

Insert as a new line: o and O

Cut chars: x and X

Replace char: r

Delete: d

Cut the whole line: dd

Cut text e.g. next word: dw

Undo: u

Redo: ctrl + r

Repeat the last command: .

Switch to visual mode: v and V (select entire line)

Copy selected: y

Copy entire line: yy

Paste: p

Save changes: :w

Quit Vim: :q

Quit without saving: :q!

Save and exit: ESC + :x

Force quit (without saving): ESC + :q!

Source current file: :so %

Compare two files: vim -d index1.php index2.php

Split view

Horizontal split: :sp

Vertical split: :vsp

Jump up: ctrl + k

Jump down: ctrl + j

Jump left: ctrl + h

Jump right: ctrl + l



Open app: mvim




Command: :PluginInstall


Browser current working directory: -

Go up one folder: -

Create directory: d

Delete directory: D (asks for confirmation)

Delete selected file: D (asks for confirmation)

Create a file: %


Toggle sidebar: :NERDTreeToggle

CtrlPSwitch from file to file: ctrl + p

You may also like: Full Bash Tutorial

Like it? Share with your friends!


What's Your Reaction?

hate hate
confused confused
fail fail
fun fun
geeky geeky
love love
lol lol
omg omg
win win

One Comment

Your email address will not be published. Required fields are marked *

Choose A Format
Personality quiz
Series of questions that intends to reveal something about the personality
Trivia quiz
Series of questions with right and wrong answers that intends to check knowledge
Voting to make decisions or determine opinions
Formatted Text with Embeds and Visuals
The Classic Internet Listicles
The Classic Internet Countdowns
Open List
Submit your own item and vote up for the best submission
Ranked List
Upvote or downvote to decide the best list item
Upload your own images to make custom memes
Youtube, Vimeo or Vine Embeds
Soundcloud or Mixcloud Embeds
Photo or GIF
GIF format