๐ Overview
Even though cPanel & WHM automate many server tasks, knowing basic Linuxยฎ command line commands can be incredibly helpful when managing your website or server. Below youโll find a list of essential commands and their usage.
Note: For instructions on accessing your serverโs command line, see the How to Access the Command Line documentation.
๐ Basic Linux Command Line Cheatsheet
๐ Common Commands
man commandโ View manual page for a command.cat filenameโ Print file contents.less filenameโ View file page by page.cd /path/โ Change directory.ls -alโ List files (with details, including hidden files).chmod 755 filenameโ Change file permissions.chown user:group filenameโ Change file ownership.cp file1 file2โ Copy a file.mv source destโ Move/rename file.rm filenameโ Delete a file.touch filenameโ Create empty file.file filenameโ Identify file type.grep 'text' filenameโ Search text in file.tail -100 filenameโ View last 100 lines of a file.wc filenameโ Count words/lines/chars.find /path/ -name filenameโ Search for files.ln -s target linknameโ Create symlink.ps -auxโ List processes.wโ List logged-in users.netstatโ Show network connections.pico filenameorvi filenameโ Edit file.
๐ง Combining Commands
- Pipe output:
command1 | command2 - Redirect output:
command > file(overwrite) orcommand >> file(append). - Use input from file:
command < file.
Examples
grep User /path/httpd.conf | moreโ Search for โUserโ and view paginated.last -a > /root/lastlogins.tmpโ Save login history.mysql -e 'show processlist' | wc -lโ Count MySQL threads.netstat -an | grep :80 | wc -lโ Count Apache connections.tail -10000 /var/log/exim_mainlog | grep 'example.com' | moreโ Search logs.
Tip: Periods . in regex act as wildcards; escape them with \. for literal matches in grep.
