Basic Linux Commands Every VPS User Should Know Print

  • vps, linux, commands
  • 0

 

When you log in to your VPS via SSH, you’re interacting with your server through the Linux command line. Whether you’re hosting a website, running scripts, or managing services, knowing a few essential Linux commands will help you operate your server effectively.

 

Below is a list of commonly used Linux commands that every VPS user should know.

 


 

1. File and Directory Navigation

 

pwd

 

Prints the current working directory.

pwd

ls

 

Lists files and directories in the current directory.

ls
ls -l        # Long listing format
ls -a        # Show hidden files

cd

 

Changes the directory.

cd /var/www
cd ..        # Go one level up

 

 


 

2. File and Directory Management

 

mkdir

 

Creates a new directory.

mkdir myfolder

touch

 

Creates a new empty file.

touch index.html

cp

 

Copies files and directories.

cp file.txt /backup/
cp -r folder1 folder2   # Recursively copy a folder

mv

 

Moves or renames files and directories.

mv file.txt /backup/
mv oldname.txt newname.txt

rm

 

Deletes files and directories.

rm file.txt
rm -r foldername    # Deletes a directory and its contents

Warning: Be cautious with rm -r and rm -rf as they can permanently delete important files.

 


 

3. Viewing and Editing Files

 

cat

 

Displays the contents of a file.

cat filename.txt

nano

 

Simple text editor to edit files.

nano filename.txt

Press Ctrl + X to exit, Y to save changes, and Enter to confirm.

 

less

 

Views large files one page at a time.

less /var/log/syslog

Use q to quit.

 


 

4. System Monitoring

 

top

 

Displays running processes and system resource usage.

top

htop

 

Enhanced version of top (requires installation).

htop

df -h

 

Shows disk space usage in a human-readable format.

df -h

free -m

 

Displays available memory.

free -m

 

 


 

5. User and Permission Management

 

adduser

 

Adds a new user.

adduser newuser

passwd

 

Changes a user password.

passwd root

chown

 

Changes file owner.

chown user:group file.txt

chmod

 

Changes file permissions.

chmod 755 script.sh

 

 


 

6. Package Management (Debian/Ubuntu)

 

apt update

 

Updates the package list.

apt update

apt upgrade

 

Installs available updates for installed packages.

apt upgrade

apt install

 

Installs a package.

apt install nginx

apt remove

 

Removes a package.

apt remove nginx

 

 


 

7. Service Management (Systemd)

 

systemctl

 

Start, stop, and manage services.

systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl status nginx

 

 


 

8. Network Commands

 

ping

 

Checks connectivity to a host.

ping google.com

ss -tulpn

 

Lists open ports and listening services.

ss -tulpn

curl

 

Transfers data from or to a server (e.g., test website response).

curl http://localhost

 

 


 

Conclusion

 

These basic Linux commands provide a solid foundation for managing your VPS. As you become more familiar with the command line, you’ll be able to automate tasks, monitor performance, and maintain a secure server environment.

 

For more advanced usage or specific tasks, check out other tutorials or contact https://my.hosteons.com

 

 

 


Was this answer helpful?

« Back