Updated: 22 October 2026 · Applies to: any Linux distribution, standard coreutils and shell commands
These are the Linux commands used most often at the command line: listing, viewing, editing, searching and managing files, checking who is logged in, and checking running processes.
1. ls
Lists the files and directories in your current directory (similar to dir on Windows). Add -al to also show dotfiles (files whose name starts with a period) and full file details:
ls -al
2. cd location
Changes directory. Replace location with the path you want to move to, for example:
cd /usr/local/apache/
3. cat filename
Prints a file's contents to the terminal. Replace filename with the file's path:
cat filename.txt
To view what is currently on the server's console screen:
cat /dev/vcs1
4. tail filename
Prints the last 20 lines of a file:
tail filename.txt
Add a number to change how many lines are printed, for example the last 100:
tail -100 filename.txt
5. more filename
Prints a file one screen at a time:
more filename.txt
6. vi filename
Opens a file in the vi text editor:
vi filename.txt
7. pico filename
Opens a file in the pico text editor, where it is installed:
pico filename.txt
8. grep string filename
Searches a file for a string and prints every matching line. Use single quotes around a multi-word string:
grep 'coffee filters' grocerylist.txt
9. touch filename
Creates an empty file at the given path:
touch example.txt
10. ln -s file1 file2
Creates a symbolic link. Replace file1 with the existing file and file2 with the new link's name:
ln -s /pointtome/file.txt symlink-file.txt
11. rm filename
Deletes a file, asking for confirmation first:
rm trash.txt
12. last
Lists which users recently logged in and when.
13. w
Lists currently logged-in users and where they logged in from.
14. netstat
Lists the server's current network connections.
15. file filename
Guesses a file's type from its contents:
file example.txt
16. du
Shows disk usage for each directory and subdirectory under the current path.
17. wc filename
Prints the word, line and byte count for a file:
wc example.txt
18. cp file1 file2
Copies a file. Replace file1 with the existing file and file2 with the new copy's path:
cp original.txt /copies/duplicate.txt
19. chmod permissions filename
Changes a file's octal permissions, for example to 755:
chmod 755 myfile.txt
20. chown user:group filename
Changes a file's owner and group:
chown joe:joesgroup joesfile.txt
21. whereis name
Finds where an installed program lives. Common locations include:
/usr/sbin/sendmail/usr/bin/perl/bin/mail/usr/bin/php
22. ps
Shows the server's current processes. Either of these lists every running process:
ps -auxww ps -cef