X

Linux Basics: 15 Commands for those who just switch from Windows to Linux

If you want to switch from Windows to Linux due to personal interest or due to job requirements, then this article will help you get started with the Linux command line. In this article, I have included a list of 15 basic Linux commands that you should know.

I have demonstrated all the examples in this article using Ubuntu 20.04 LTS system, but these commands are available on most other Linux distributions as well.

ls Command

List Directory Contents (ls) command will list all the files and directories within a current working directory (default) or given path. It also displays the information about files using the options parameter. In Windows, it can be performed using the dir command which is the same as ls -l.

$ ls -l

lsblk Command

The lsblk command refers to List Block Devices which show detailed information about all the available block devices but RAM is excluded in the tree-like format. In Windows, you can perform it using the wmic command.

$ lsblk

pwd Command

The pwd command refers to the print working directory which displays the path from the root directory (/) to the current working directory. You can achieve it using the chdir or cd command with no argument.

$ pwd

History Command

The history command is used to view all the commands you have executed in Linux. Sometimes you want to review previously run commands you can do so using the history command similarly in Windows you can do so using the ‘doskey /history’ command.

$ history

Package Manager

In Linux package manager are the software tools that help to search, remove, download and install the packages maintained by the Linux community. The package managers are different according to the respective Linux family.

For Ubuntu/Debian

# apt install package_name

For Centos/Fedora/RedHat/Rocky Linux/AlmaLinux

# yum install package_name

Or

# dnf install package_name

mkdir Command

The mkdir refers to the Make Directory which is used to create the directory in your current working directory. The mkdir command only creates the directory only if there is enough permission and the directory doesn’t exist. You can create the directory in windows using the md command.

$ mkdir directory_name

touch Command

The touch command is used to create the file in Linux if it doesn’t exist but will update timestamp and content inside the file remains constant. You can only create the file only if you have written permission to the directory.

sudo Command

Sudo command is used when you need the superuser privilege to perform a specific task. Only users of the sudo or wheel group can execute the sudo command it may be a variant for the different Linux distro. It’s similar to running the command prompt as administrator when permission isn’t enough.

$ sudo ls /etc

su Command

The su stands for Switch User which is used to switch users between two users. Using the su command you can easily switch the user in the terminal.

chmod Command

The chmod (Change File Mode Bits) is the command which is used to change the permission of the files, script, directory, etc. In Linux, permissions are categorized into three different types.

Read(r) → 4

Write(w) → 2

Execute(x) → 1

In Linux files and directory permission is determined in three-part, the first alphabet determines the file type the remaining 9 characters are permission for Owner, Group, and other users respectively divided into 3 characters to each. If you need to determine the permission to the file using the chmod command you need to add up the permissions reference number. For example,

If you want to give read and write permission to the file you just need to add 4+2 =6 and execute the command as follows.

$ chmod 777 test.text

chown Command

The chown command is used to transfer ownership of the file to other users to do so you need the root privileges or the root user. You can change the ownership only if you have root privilege.

# chown sanju:sanju test.txt

tar Command

Just like a zip file compressor, in Linux tar command is used to compress the files or group of files into a single compress file. Linux also supports zip but tar has a high compression capability as compared to the zip.

cat Command

The cat refers to Concatenation which is used to join more than one file as well as print the content inside the file on standard output.

cp Command

The cp (copy) command is used to copy files from one directory to another. It also supports wildcard characters to determine the files.

mv Command

The mv (move) command is used to move the file from one destination to another destination. It can also be used to rename the file or directory.

Conclusion

These are the 15 basic commands of Linux for those who want to switch to Linux from Windows. Thank you for taking your time to read this article I hope this article guide you well.

Karim Buzdar: About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various websites.
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings