A few dozen shell commands cover most everyday Linux work: moving around, handling files, reading logs, checking disk space and processes. Which ones you can use depends on where you are logged in: on your own VPS you have root, while on shared hosting you get a jailed shell limited to your own account. This page gives the fundamentals with current, safe examples, and points you to the full guide for each case.
Look before you change: pwd, ls -lah, less, tail, df -h and du -sh are safe anywhere. Use cp, mv, tar and chmod with care, and treat rm -rf as permanent. On shared hosting, jailed SSH is available on request with key login; scp, SFTP, tar, git and php work there, but rsync, sudo and package installs do not. On your own VPS, use dnf or apt for packages, systemctl for services, and ip and ss instead of the old ifconfig and netstat.
On your own VPS or server, read Linux server mastery: essential shell commands. On Domain India shared hosting, read How to log in using SSH and essential Linux commands.
1. Where you run commands changes what works
| Task | Shared hosting (jailed shell) | Your own VPS (root) |
|---|---|---|
| Browse, read and edit your files | Yes | Yes |
| Copy files in and out | scp and SFTP; rsync is not available | scp, SFTP and rsync |
| Archives and Git | tar and git | Anything you install |
| Install packages, restart services | No | Yes, with sudo |
| Firewall and network settings | No | Yes |
Jailed SSH is available on every shared hosting plan (cPanel, DirectAdmin, Webuzo). It is off by default; ask support to enable it for your account, and log in with an SSH key, because password login over SSH is off. Windows (Plesk) hosting has no SSH. See enabling and accessing jailed SSH.
2. Finding your way around
pwd # which folder am I in?
ls -lah # list files, including hidden ones, with sizes
cd public_html # go into a folder
cd .. # up one level
cd ~ # back to your home folderls -l shows permissions, owner, size and date for each file. Adding -a includes hidden files such as .htaccess, and -h shows sizes in K, M and G.
3. Working with files and folders
mkdir -p backups/2026 # create a folder, with parents
touch notes.txt # create an empty file or update its date
cp -a public_html site-copy # copy a folder, keeping permissions and dates
mv old-name.php new-name.php # rename or move
rm file.txt # delete a file
rm -ri old-folder # delete a folder, asking for each filerm -rf deletes permanently, with no recycle bin. Run pwd and ls first, never run it on a path built from a variable you haven't checked, and copy anything important before you delete. On a VPS, rm -rf as root can destroy the whole system.
4. Reading and editing files
cat small-file.txt # print a short file
less error_log # read page by page: Space for next, q to quit
tail -n 50 error_log # the last 50 lines
tail -f error_log # watch new lines arrive (Ctrl+C to stop)
nano .htaccess # simple editor: Ctrl+O saves, Ctrl+X exitsnano is the easiest editor for beginners and is available in the shared-hosting jailed shell. vi or vim is more powerful but has a learning curve: press i to type, Esc then :wq to save and quit.
5. Permissions and ownership
chmod 644 index.php # files: owner writes, everyone reads
chmod 755 public_html/uploads # folders: owner full, others read and enter
find public_html -type d -exec chmod 755 {} + # every folder
find public_html -type f -exec chmod 644 {} + # every fileFor websites, files are usually 644 and folders 755. Don't run chmod -R 644 on a folder: it removes the "enter" permission from every subfolder and breaks the site. Never use 777. On shared hosting you own your files already, so chown is only needed on a VPS, for example sudo chown -R nginx:nginx /srv/app.
6. Searching
find . -name "*.php" -mtime -2 # PHP files changed in the last 2 days
grep -rn "DB_PASSWORD" --include=*.php . # where a setting is defined
grep -i "fatal" error_log | tail # recent fatal errorsfind with -mtime is a quick way to spot files that changed recently, which helps after a hack. More in the grep guide.
7. Disk space, archives and transfers
df -h # free space on each filesystem (VPS)
du -sh * | sort -h # which folders are largest
tar -czf site-$(date +%F).tar.gz public_html # pack a folder
tar -xzf site-2026-09-24.tar.gz # unpack itOn shared hosting, your plan's disk quota is what counts; see how to check resource usage. Keep archives outside public_html, or anyone could download them.
To move files between your computer and the server, pack them, copy the archive with scp, then unpack it on the other side. This works on shared hosting, where rsync is not available:
scp -P 22 site.tar.gz [email protected]:~/8. Processes and system information (VPS)
These are most useful on a server you manage:
top # live CPU and memory use (q to quit)
ps aux --sort=-%mem | head # the processes using the most memory
kill 12345 # ask a process to stop; kill -9 only as a last resort
free -h # memory and swap
uptime # load averages
uname -r # kernel version9. Old commands and their replacements
Many older tutorials use commands that are deprecated or missing on current distributions:
| Old command | Use instead | Why |
|---|---|---|
| ifconfig | ip addr | ifconfig is in the old net-tools package, often not installed |
| netstat -tuln | ss -tulpn | ss is installed by default |
| yum install | dnf install | On AlmaLinux and Rocky Linux, yum is only an alias for dnf |
| apt-get install | apt install | apt is the friendlier front end on Ubuntu and Debian |
| service name restart | systemctl restart name | systemd manages services on current distributions |
CentOS Linux has reached end of life. For a new server, use AlmaLinux or Rocky Linux, or Ubuntu LTS or Debian. The commands above work the same on all of them, apart from the package manager.
Frequently asked questions
What are the most useful basic Linux shell commands?
pwd, ls and cd to move around; less and tail to read files and logs; cp, mv and rm to manage files; chmod for permissions; find and grep to search; and df -h and du -sh to check disk space.
Can I use these commands on Domain India shared hosting?
Most file commands, yes. Jailed SSH is available on every shared plan on request, with SSH key login. You can use file commands, tar, scp, SFTP, git and php, but not rsync, sudo, package installs or service control.
How do I get SSH access on shared hosting?
Ask Domain India support by live chat or ticket to enable jailed SSH for your account, then add your SSH public key. Password login over SSH is switched off. Windows (Plesk) hosting has no SSH.
Why is ifconfig or netstat not found?
They belong to the old net-tools package, which current distributions do not install by default. Use ip addr instead of ifconfig and ss -tulpn instead of netstat.
Should I use yum or dnf?
Use dnf on AlmaLinux and Rocky Linux; yum is only an alias for it there. On Ubuntu and Debian, use apt.
How do I copy a website to the server without rsync?
Pack the files with tar on your computer, upload the archive with scp or SFTP, then unpack it on the server with tar -xzf. This works in the shared-hosting jailed shell.
Ready to start? Ask support to enable SSH from a new ticket, create your SSH key, or see VPS plans if you need root access.
A self-managed VPS gives you full root SSH access to install packages, run services and manage the firewall.
See VPS plans