Skip to main content

Linux Shell Commands

An enumeration of some commonly used shell commands in Linux or Unix-based systems.

Command Description Options
pwd Displays the current working directory on the terminal.
ls List the files and subdirectories in the current working directory. -a: all files, including hidden ones
-l: long and detailed list, including ownership, permissions, modification dates, and file sizes
-R: contents of directory as well as subdirectories
cd Change the current working directory.
cp Copy files and directories from one location to another. -R: copy the entire directory structure using recursion
mv Moves files and directories from one location to another.
rm Deletes files and directories in a location.
cat Print a file's contents on the terminal.
less Display the contents of a text file on the terminal, but only one screen's worth at a time.
head Print the first few lines of a text file's contents on the terminal.
tail Print the last few lines of a text file's contents on the terminal.
vi/vim Open the Vim text editor for a file.
su Switch user accounts for the current terminal session. Use the - flag to indicate the root user. [deprecated]
chown Change which user owns a specific file or directory.
chgrp Change the group that owns a file or directory.
chmod Edit the permissions for the owner, group, and others for a specific file or directory.

More info can be found here.