Ubuntu Server Common Commands

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

Host Shared Drive

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.

Similar Posts

  • Ubuntu Samba Server

    If you need to create a shared drive on an Ubuntu Server that Windows and Linux users can access, SAMBA is the perfect solution. This article will guide you through installing SAMBA, configuring a shared folder, and setting up user permissions. Step…

  • Two-Line Prompt

    To have your terminal show the input command on its own line, with your username and the current working directory (PWD) on a separate line, you will need to modify the shell prompt (PS1) in your terminal configuration. Here’s how you can…

  • Ubuntu Server Programs

    This is list of programs I use on my Ubuntu Servers with some very basic information. Some of my favorite and most useful Ubuntu Server programs include Network-Tools, Ranger, TMUX, and CMUS for efficient terminal-based management. Network-Tools helps with quick network diagnostics,…

  • TMUX

    TMUX is an easy to use Terminal Multiplexer where users can split the Terminal CLI (Command Line Interface) into multiple mini Terminals. Here’s a TMUX Cheat Sheet with essential tmux commands: Installing tmux The following command installs tmux from the snap repositories….