Skip to content

Command Line

Bash Cheatsheet

Quick guide for general Bash / Shell commands and shortcuts.

native Client-side

File & Directory Navigation

5
pwd

Print working directory path.

ls -la

List files including hidden files, with detailed properties.

cd /path/to/dir

Change current working directory.

cd ..

Move up one directory level.

cd ~

Move to user home directory.

File Operations

8
touch file.txt

Create a empty file.

mkdir new_folder

Create a new directory.

mkdir -p parent/child

Create nested directories.

cp src.txt dest.txt

Copy file.

cp -r folder_src/ folder_dest/

Copy directory recursively.

mv src.txt dest.txt

Move or rename file.

rm file.txt

Delete file.

rm -rf folder/

Force-delete directory recursively (use with caution).

File Viewer & Grep

6
cat file.txt

Concatenate and display file content.

less file.txt

Open file viewer supporting page-by-page scrolling.

head -n 10 file.txt

Output first 10 lines of file.

tail -n 10 -f file.txt

Output last 10 lines and follow additions in real-time.

grep "pattern" file.txt

Search for string pattern in file.

grep -r "pattern" ./dir/

Search recursively in all files under directory.

System Info & Process

6
df -h

Display disk space usage in human-readable format.

du -sh ./folder/

Calculate size of directory.

free -h

Display system RAM usage.

top

Interactive real-time process monitor.

ps aux | grep node

List active processes matching "node".

kill -9 <PID>

Force kill process by Process ID.

Permissions & Ownership

4
chmod +x script.sh

Grant execution permissions to file.

chmod 755 file.txt

Set read, write, execute permissions (User: RWX, Group/World: RX).

chown user:group file.txt

Change file owner and group.

sudo <command>

Execute command with superuser (root) privileges.

Network Utilities

4
ping google.com

Ping host to check connectivity.

curl -i https://api.github.com

Send HTTP request and print headers.

wget https://example.com/file.zip

Download file from web.

ssh user@host

Connect to remote host via SSH.

Bash & Linux Commands Cheatsheet

Bash (Bourne Again SHell) is the default Unix/Linux shell environment. This searchable cheatsheet covers directory navigation, file modification, permissions, process monitoring, and networking utilities.

Frequently Asked Questions

What is the difference between relative and absolute paths?

An absolute path specifies the path starting from root directory (e.g. /usr/local/bin). A relative path specifies a path relative to the current working directory (e.g. ./bin or ../styles).

How do I change file permissions?

Use the chmod cmdlet. For example, chmod +x script.sh makes the script file executable. You can also specify numerical octals, such as chmod 755 filename.