๐Ÿš€ Basic Linux Command Line Commands You Should Know

๐Ÿ“Œ 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 filename or vi filename โ€“ Edit file.

๐Ÿ”ง Combining Commands

  • Pipe output: command1 | command2
  • Redirect output: command > file (overwrite) or command >> 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.

Scroll to Top