
The short answer: on a VPS there is no mouse and no windows, but three tools solve almost everything a beginner needs: nano to edit a file, grep to search for text inside files and find to locate files. All come with the system.
nano: editing a file
Open with nano /path/to/file (if the file belongs to the system, put sudo in front). Type as normal. The shortcuts are listed at the bottom of the screen; the ^ symbol means the Ctrl key.
| To | Shortcut |
| Save | Ctrl+O and then Enter |
| Quit | Ctrl+X (if there are changes, it asks whether to save) |
| Search inside the file | Ctrl+W |
| Delete the current line | Ctrl+K |
| Go to a line | Ctrl+_ and the number |
grep: searching for text
| To | Command |
| Lines with a word in a file | grep -n "error" /var/log/app.log |
| Ignoring upper and lower case | grep -in "error" file |
| In every PHP file of a folder | grep -rn "word" /var/www/site --include="*.php" |
| The lines that do NOT have the word | grep -v "word" file |
| Follow a log live | tail -f /var/log/app.log |
The -n shows the line number and the -r goes into subfolders. To read a big file a little at a time, use less file (quit with q).
find: locating files
| To | Command |
| A file by name | find /var/www -name "wp-config.php" |
| Changed in the last 24 hours | find /var/www/site -type f -mtime -1 |
| Larger than 100 MB | find / -type f -size +100M 2>/dev/null |
The 2>/dev/null hides the “Permission denied” messages. The second line is useful if the site was changed without you knowing; the third helps when the disk fills up: see No space left on device.
| Before editing a configuration file, take a copy: cp -a file file.before. And do not use rm with asterisks on files found by a find without looking at the list first. See also Linux file permissions. |
| Is this your first VPS? Start with First steps with your VPS. To know where the logs you will want to search are: Where are the logs on a Linux VPS. |
|
Searched and cannot find the cause of an error on the server? Open a ticket with the log file and the error line. Open a support ticket |
|
SEE ALSO Where are the logs on a Linux VPS: journalctl and /var/log Linux file permissions on a VPS: chmod, chown and Permission denied |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from $6.60/mo (3-year plan, with coupon) See plans |
- 0 Users Found This Useful











