Ubuntu Commands

Update and Upgrade

-y automatically confirms the prompts.

sudo apt update && sudo apt upgrade -y

Install Software

sudo apt install <package-name>

Remove Software

sudo apt remove <package-name>

Search for Software

apt search <package-name>

Clean Up

sudo apt autoremove -y
sudo apt clean

Check Disk Space

df -h

Check Memory Usage

free -h

Reboot System

sudo reboot

Shutdown System

sudo shutdown now

View System Information

uname -a

View Running Processes

top

or

htop

Change File Permissions

chmod <permissions> <file-or-directory>

e.g., chmod 755 script.sh

Number codes:

  • 7 = read, write, execute
  • 6 = read, write
  • 5 = read, execute
  • 4 = read only
  • 3 = write, execute
  • 2 = write only
  • 1 = execute only
  • 0 = no permissions

Change File Ownership

sudo chown <user>:<group> <file-or-directory>

e.g., sudo chown benjamin-f:benjamin-f myfile.txt

View Network Configuration

ifconfig

or

ip a

Ping a Host

ping <hostname-or-ip>

e.g., ping google.com

Train (sl)

sudo apt install sl
sl

Install fish shell

sudo apt install fish
chsh -s /usr/bin/fish

Install oh-my-fish

curl -L https://get.oh-my.fish | fish
omf install <theme-name>

Navigation