Ubuntu Command-Line Interface for VPS Management
Ubuntu provides a powerful command-line interface (CLI) that serves as the primary management tool for Virtual Private Servers (VPS). The CLI offers comprehensive system control through text-based commands, enabling efficient file management, software installation, system monitoring, and service administration.
Essential File and Directory Commands
| Command |
Description |
Example |
ls |
Lists files in a directory |
ls /home/user/Documents/ |
ls -a |
Displays all files including hidden ones |
ls -a ~/ |
cd |
Changes to specified directory |
cd /path/to/directory |
pwd |
Shows current directory path |
pwd |
mkdir |
Creates new directory |
mkdir new_folder/ |
rmdir |
Removes empty directory |
rmdir empty_folder/ |
cp |
Copies files |
cp file.txt /backup/ |
cp -r |
Copies directories recursively |
cp -r site/ /var/www/ |
mv |
Moves or renames files/directories |
mv old_file.txt new_location/ |
rm |
Deletes files |
rm unwanted_file.txt |
rm -r |
Removes directories and contents |
rm -r old_folder/ |
File Viewing and Editing
| Command |
Description |
Example |
cat |
Displays complete file contents |
cat file.txt |
less |
Views file contents page by page |
less logfile.log |
nano |
Opens file in Nano text editor |
nano ~/document.txt |
vim |
Opens file in Vim editor |
vim config.conf |
touch |
Creates empty file |
touch newfile.txt |
Package Management (APT)
| Command |
Description |
Example |
apt update |
Updates package repository list |
apt update |
apt upgrade |
Upgrades installed packages |
apt upgrade |
apt install |
Installs software packages |
apt install nginx |
apt remove |
Removes packages |
apt remove apache2 |
apt autoremove |
Removes unused dependencies |
apt autoremove |
apt search |
Searches for packages |
apt search docker |
apt show |
Displays package information |
apt show nginx |
Process and System Monitoring
| Command |
Description |
Example |
top -c |
Shows live running processes |
top -c |
htop |
Enhanced interactive process viewer |
htop |
ps aux |
Lists all running processes |
ps aux |
ps aux | grep |
Filters process output |
ps aux | grep nginx |
uptime |
Shows system uptime and load |
uptime |
free -h |
Displays memory usage |
free -h |
df -h |
Shows disk usage by filesystem |
df -h |
du -sh |
Shows directory size |
du -sh /var/log |
Network Management
| Command |
Description |
Example |
ping |
Tests network connectivity |
ping google.com |
ip a |
Displays network interfaces |
ip a |
ss -tuln |
Lists listening ports |
ss -tuln |
netstat -tuln |
Shows open ports (legacy command) |
netstat -tuln |
curl |
Transfers data from URLs |
curl -I https://vluxon.com |
wget |
Downloads files from web |
wget https://vluxon.com/file.zip |
User and Permission Management
| Command |
Description |
Example |
whoami |
Shows current username |
whoami |
adduser |
Creates new user account |
adduser vluxon |
passwd |
Changes user password |
passwd vluxon |
usermod -aG |
Adds user to group |
usermod -aG sudo vluxon |
chmod |
Modifies file permissions |
chmod 755 script.sh |
chown |
Changes file ownership |
chown user:user file.txt |
su |
Switches to different user |
su root |
sudo |
Executes commands as root |
sudo apt update |
Service Management
| Command |
Description |
Example |
systemctl status |
Checks service status |
systemctl status nginx |
systemctl start |
Starts service |
systemctl start nginx |
systemctl stop |
Stops service |
systemctl stop nginx |
systemctl restart |
Restarts service |
systemctl restart nginx |
systemctl enable |
Enables service at boot |
systemctl enable nginx |
journalctl -xe |
Views system logs |
journalctl -xe |
System Control
| Command |
Description |
Example |
reboot |
Restarts the system |
reboot |
shutdown -h now |
Shuts down immediately |
shutdown -h now |
Firewall Management
| Command |
Description |
Example |
ufw status |
Shows firewall status |
ufw status |
ufw enable |
Activates firewall |
ufw enable |
ufw allow |
Opens port |
ufw allow 22 |
ufw deny |
Blocks port |
ufw deny 80 |
Session and Automation Tools
| Command |
Description |
Example |
screen |
Creates virtual terminal session |
screen -S my_workspace |
screen -r |
Reattaches to screen session |
screen -r my_workspace |
tmux |
Launches terminal multiplexer |
tmux new -s session1 |
crontab -e |
Edits scheduled tasks |
crontab -e |
crontab -l |
Lists cron jobs |
crontab -l |
history |
Shows command history |
history |
clear |
Clears terminal display |
clear |
exit |
Exits current session |
exit |
These Ubuntu CLI commands provide comprehensive control over VPS environments, enabling efficient server management.
Related Articles
Looking for a reliable VPS to practice these commands? Explore Vluxon VPS solutions with full root access and instant deployment.