
This is a list of commands that I commonly use with my Ubuntu Servers.
Command line symbols
&&: allows multiple commands but if a command fails the string stops.
-Common example: sudo apt update && sudo apt upgrade
:: allows multiple commands to be stringed together but will finish even if there is a failure.
-Common Example: sudo apt update : sudo apt upgrade
SSH Key Reset
ssh-keygen -R <Your-Server-IP>
Example: $ ssh-keygen -R 192.168.2.222
Mount New Drive
lsblk
sudo mkdir /mnt/sdb
sudo mount /dev/sdb1 /mnt/sdb
Plex Local IP Port
https://<Server-IP-Address>:32400/web
Example: https://192.168.1.200:32400/web
Net-Tools
Allows user to list out useful network information for other devices on local network.
- sudo apt install net-tools
- arp -a
TShark
A CLI version of Wireshark
sudo apt install tshark
Check sub-directory size:
first navigate to the parent directory that you wish to check the child directory size for then type in.
du -sh ./*/
Copy files to new location
sudo rsync -av /source/folder /destination/location
sudo cp -r /Source/folder /destination/location
Journal Check
sudo journalctl -f
Ubuntu Server is a great system for hosting Samba Shared Drives.
sudo apt install samba
sudo nano /etc/samba/smb.conf
sudo systemctl restart smbd
Mount Network Storage
This section explains how to create a local directory on your Ubuntu server and then mount a remote Windows/Samba network share to it using the CIFS filesystem. Once mounted, the remote shared folder becomes accessible like a normal local folder at /mnt/SharedFolder.
sudo mkdir /mnt/<Drive-Name>
*Example: sudo mkdir /mnt/SharedFolder
sudo mount -t cifs -o username=<YOUR-USERNAME>,password=<YOUR-USERNAME>,vers=2.0 //<SERVER-IP-Address>/<Shared-Folder>
*Example: sudo mount -t cifs -o username=YourUserName,password=YourPassword,vers=2.0 //192.168.1.200/SharedFolder
Remember that everything is Capitalization sensitive – This includes the ‘SharedFolder’.
If a directory has a space in the name then the command will need to have apostrophes on both sides. For example: /mnt/’Folder Name With Spaces’
Find Text
sudo find /DIR/Path -name “filename”
the /Dir/Path is not required
Hot-keys
Ctrl + C: Stops current command
Ctrl + A: Cursor to front of line
Ctrl + U: Erase current prompt
BTOP
sudo apt install btop
btop
q
Neofetch
sudo apt install neofetch
neofetch
CMATRIX
cmatrix
Just a fun screensaver.
Ranger
Ranger is a program that makes navigating the Ubuntu Server file system easy. Be sure to run it as sudo so you can make changes.
sudo apt install ranger
sudo ranger
FFMPEG
CMUS
TMUX
TMUX is a terminal multiplexer that lets you run multiple terminal sessions inside a single window. It allows sessions to stay running in the background even after you disconnect.
Ctrl + B, % – Splits the Terminal Vertically.
Ctrl + B, ” – Splits the Terminal Horizontally.
Ctrl + B + (Any Arrow) – Adjusts window size.
Ctrl + B, (Any Arrow) – Change Window Selection.
