Cheatsheet of Basic Linux Commands

Command Line Interpreter(CLI) is one of the MVP(most valuable Product) of the Unix Operation Systems. Programs with CLI are generally easier to automate.

The general pattern of an OS(Operating System) command-line interface is

Prompt command param1 param2 param3 ... paramN

 

These commands are really helpful in using the basic functionalities of Linux.

Cheatsheets of Basic Linux Commands

Command Usage
cal Display calendar of the current month.
echo Display the value of a variable.
date Current date and time along with timezone.
tty filename of the terminal connected to standard output.
whoami Currently logged in user.
id

Real and effective user and group IDs.

clear Clears the output screen.
--help Can be used with almost any command, e.g echo --help; gives the usage instructions for the command.
whereis Location of the binary, source, and manual page files for a command.
which Location of a command.
whatis Display one line manual instruction page.
man An online reference to the manual reference page of the command; more descriptive than whereis and help.
pwd Absolute path to the working directory.
ls List the contents of the current directory.
cd Change the current working directory.
chmod

Change the permissions of a file/directory.

chown Change the owner of a file/directory.
sudo Execute a command as another user or the superuser.
mkdir Create a directory.
touch Create an empty file.
mv Move files/directories.
cp Copy files/directories.
dd Copy a file, converting and formatting according to the operands.
rm Remove files/directories.
stat Display file or file system status
file Determine the file type of a given file
wc Determine no. of lines, word, and bytes of a file.
cat Concatenate file(s) to standard output; with no file or when file is -, read standard input.
less Paging through text one screenful at a time; useful especially for large files.
more Paging through text one screenful at a time; less useful than less.
head Display the top n lines of a file; by default displays 10
tail Displays the bottom n lines of a file; default values is 10; extremely useful for monitor logs
grep Display the line matching a pattern; useful in searching text or pattern inside a file.
ln Make links between files.
alias Set alias (another name) for a command.
who Show who is logged in.
w Show who is logged in and what they are doing.
du Estimate file estimate usage.
df Report file system disk usage.
fdisk Manipulate the disk partition table.
ping Send an ICMP(Internet Control Message Protocol) ECHO_REQUEST to network hosts.
history All previously commands run.
top Display Linux processes.
kill Send a signal to a process
unzip List, test, and extract compressed files in a ZIP archive
shutdown Halt, power-off or reboot the machine.

If you are interested in getting a quick recap of other topics, you may view our other cheatsheets.

0 Comments

Login to join the discussion