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 stands for Print Working Directory. It shows the directory that we’re in now.
ls lists the files and directories that are in the current directory.
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 lets us make a new directory in the current working directory by typing in the directory name after mkdir.
rmdir is used to remove the directory with the given name.
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.
We can use the mount command to mount a removable storage device. This makes it available for us to use.
The df lets admins monitor and analyze server status and network systems.
Gets the Linux version information of the operating system we’re currently using.
Lists the tasks that currently running on our system.
kill lets us end tasks that are currently hung in our system.
The service command lets us run system-wide services from the terminal.
batch lets us run system services in a predefined schedule.
shutdown does what its name says. It shuts down our computer.
touch lets us create a new text file by typing in a file name after it.
cat is used to concatenate multiple files by specifying file paths of text files after it to concatenate them together.
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.
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 lets us copy files from one place or another and if it’s the same directory, it’ll rename the file.
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.
The comm command is the command to compare 2 files.
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 is used for creating symbolic links to some files for easy access.
We can use cmp to compare files and output the results to an output stream.
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.
The alias command lets us replace a word by another string. This helps us replace long commands with shorter ones.
This is a small calendar program that we can run to get some information about today’s date and other things.
The fortune command lets us see the fortune that we get for the day. It has funny and inspirational quotes.
The history commands prints out the commands that we typed and see what we’ve done in the terminal recently.
Typing yes and then some text after it just displays the text after yes forever until we stop it with Ctrl+C.
The banner command gives us the ability to make our own ASCII banners that we can see on the command line.
The rev command takes text input and writes them to the standard output and reversing each character. It’s useful for pranks.
wget lets us download files from the Internet right from the terminal. It works with HTTP, HTTPS, and FTP servers.
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.
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.