Casper-RS avatar
Made by Casper-RS

Ubuntu Bash Commands

Files & Folders

Navigate and manage directories and files

cd — change directory

cd /var/www/adminPanel
cd ..
cd ~

Change the current working directory.

cd .. goes up one level, cd ~ returns home.

mkdir — make directory

mkdir /var/www/newsite
mkdir -p /var/www/website

Create a directory.

-p creates parent folders and won’t overwrite existing ones.

ls — list files

ls
ls -l
ls -a

List files and folders.

-l shows details, -a shows hidden files.

Edit Files

Create and inspect files

nano — text editor

nano /var/www/adminpanel/config.yml

Open the Nano editor.

Exit with CTRL + X, then confirm save.

touch — create file

touch /var/www/file.txt

Create a new empty file or update timestamps.

cat — view file

cat /var/www/file.txt

Print file contents to the terminal.

Remove Files & Folders

Delete files and directories

rm — remove

rm file.txt
rm -r directory

Delete files or directories.

⚠ Never use -rf blindly.

rmdir — remove empty dir

rmdir emptyfolder

Delete an empty directory.

Permission Control

User rights and access management

sudo — run as root

sudo nano /etc/nginx/nginx.conf

Execute a command with root privileges.

su — switch user

su root

Switch to another user (usually root).

chmod — change permissions

chmod 755 file.sh
ValuePermission
7Read + Write + Execute
6Read + Write
5Read + Execute
4Read only

755 → Owner: rwx, Group: r-x, Others: r-x

Network & Data

Connectivity and HTTP tools

ping

ping casper-rs.dev

Test network connectivity and latency.

curl

curl https://example.com

Fetch data from an HTTP(S) endpoint.