Basic Linux Commands We Should All Know

John Au-Yeung - Feb 13 '21 - - Dev Community

Check out my books on Amazon at https://www.amazon.com/John-Au-Yeung/e/B08FT5NT62

Subscribe to my email list now at http://jauyeung.net/subscribe/

If we work as developers, we’ve to work with the Linux command line eventually.

In this article, we’ll look at some basic Linux commands we should know to work with the Linux command line.

pwd

pwd stands for Print Working Directory. It shows the directory that we’re in now.

ls

ls lists the files and directories that are in the current directory.

cd

cd stands for change directory. It lets us change directory to a different directory by typing in the directory name we want to switch to after cd.

mkdir

mkdir lets us make a new directory in the current working directory by typing in the directory name after mkdir.

rmdir

rmdir is used to remove the directory with the given name.

lsblk

Lists the available block devices in a system. A block device gives us access to a device in a way where the hardware characteristics of the device isn’t visible.

mount

We can use the mount command to mount a removable storage device. This makes it available for us to use.

df

The df lets admins monitor and analyze server status and network systems.

uname

Gets the Linux version information of the operating system we’re currently using.

ps

Lists the tasks that currently running on our system.

kill

kill lets us end tasks that are currently hung in our system.

service

The service command lets us run system-wide services from the terminal.

batch

batch lets us run system services in a predefined schedule.

shutdown

shutdown does what its name says. It shuts down our computer.

touch

touch lets us create a new text file by typing in a file name after it.

cat

cat is used to concatenate multiple files by specifying file paths of text files after it to concatenate them together.

head

The head command lets us view the head of the file by typing in the file path of the text file we want to view after it.

tail

The tail command lets us view the tail of the text file as it’s being updated. The updates are done live so we’ll always see the latest.

cp

cp lets us copy files from one place or another and if it’s the same directory, it’ll rename the file.

mv

mv is short for a move. It lets us move files around our system. We can use the -f switch to force the operating system to move big files.

comm

The comm command is the command to compare 2 files.

less

The less command is popular for viewing the contents of files. We can let users navigate within a file in both directions with this file.

ln

ln is used for creating symbolic links to some files for easy access.

cmp

We can use cmp to compare files and output the results to an output stream.

dd

The dd command is used to convert and copy files. We can use it to make hardware and device files appear in the file system like normal files.

After running dd, those devices will show up like regular files.

alias

The alias command lets us replace a word by another string. This helps us replace long commands with shorter ones.

cal

This is a small calendar program that we can run to get some information about today’s date and other things.

fortune

The fortune command lets us see the fortune that we get for the day. It has funny and inspirational quotes.

history

The history commands prints out the commands that we typed and see what we’ve done in the terminal recently.

yes

Typing yes and then some text after it just displays the text after yes forever until we stop it with Ctrl+C.

banner

The banner command gives us the ability to make our own ASCII banners that we can see on the command line.

rev

The rev command takes text input and writes them to the standard output and reversing each character. It’s useful for pranks.

wget

wget lets us download files from the Internet right from the terminal. It works with HTTP, HTTPS, and FTP servers.

iptables

iptables lets sysadmins control incoming and outgoing traffic on a host machine. It’s used on a regular basis to define authentic traffic and blacklist suspicious or untrusted requests.

Conclusion

Linux has lots of commands that we should know about.

We should know how to traverse directories, list files, and copy/moves files.

Also, knowing how to download files is also handy.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .