1-888-959-PAPA [7272]
24/7/365
Top
HostPapa Blog / Web Hosting  / 45 Easy Linux Commands Every User Should Know
24 Jan

45 Easy Linux Commands Every User Should Know
Share

(Last Updated On: January 24, 2023)

Linux is a powerful and versatile operating system that can be used in various ways. While it may seem daunting at first, with just a little practice, anyone can learn to use Linux effectively both for work and gaming purposes. Unlike Microsoft Windows, Linux isn’t the most popular operating system, taking only 2.81% of the current total market share.

Many professionals, though, use Linux for development reasons – on that front, Linux grabs a comfortable 40%, according to stats published by StackOverflow, a well-known forum for programmers. So it’s fair to say that the Linux operating system is widespread among programmers.

Programmers like Linux because it’s so versatile that they can tailor it to their needs. Using the command line interface or CLI defines a Linux power user and greatly expands what they can achieve. But most importantly, developers and programmers use Linux because it’s free and open source.

Another aspect that makes Linux very popular is its ability to work on any device. From your smartwatch and fitness tracker to smartphones and massive data centres, Linux can power all these devices, making it one of the most flexible operating systems currently available.

45-Easy-Linux-Commands-Every-User-Should-Know-Inner-01

Linux commands can help users manage files and directories, change permissions, install applications, edit text files, and much more. With just a little practice, you’ll be able to navigate your way around Linux easily, and if you’re a power user, they can help you get the most out of the Linux operating system.

In this HostPapa blog post, we’ll discuss some simple Linux commands that every user should know to make their experience with the OS more fluid and complete. We’ll also provide tips on becoming a Linux power user and getting the most out of the software.

What Is a Linux Command?

Linux commands are programs that run from a command line window. They’re much like regular programs; the only difference is that they don’t have a graphical user interface (GUI).

Many programs (even on Windows) can work in command line mode, and people can use the forward slash (/) to input more commands into the program. On Linux, we mainly use the hyphen (-) to input commands to our program. These extra commands are called arguments or parameters.

Long before GUI was invented, people would do everything from a terminal. While some people will now say that a terminal is hard to work with, many system administrators use it daily, and others get used to it so much that they can’t live without it.

45 Simple and Easy Linux Commands

This list contains 45 of the most used and notable Linux commands you’ll need to begin your journey to the fantastic world of the Linux operating system.

sudo Command

If you’re familiar with the “run as admin” command from Windows, that’s great, as the sudo command on Linux is the same. By adding the word sudo before your command, you run it with escalated privileges.

This is useful when navigating to protected folders or changing settings and files requiring administrator access.

45-Easy-Linux-Commands-Every-User-Should-Know-Inner-02

man Command

When working on Linux, you might find yourself stuck while using the command line. Nowadays, searching online for answers is pretty fast, but you have the man command to help you figure out things if you’re on Linux.

The man command displays a manual of the command running in the terminal, so you can learn how to use it. It displays the command’s description, flags, and options you can use in the terminal. It’s pretty valuable when the computer doesn’t have an active internet connection, and you want to learn what a specific command does.

apt, pacman, yum install Command

Linux isn’t just one operating system. There are thousands of versions called distributions (or distros for short), and different distributions come with various package managers. A package manager is where you can download new applications for your system, which is also accessible from the terminal.

The most popular package managers are:

  • apt: works on Debian-based distributions
  • pacman: short for package manager, used on Arch-based distributions
  • yum: works on Fedora and CentOS distributions

If you’re starting with Linux, knowing how to install applications from the command line interface (CLI) is essential and a vital part of Linux.

wget Command

This is the command to download a file from the internet. The wget command is handy as you can download almost every file without an internet browser or another download manager.

You can even resume an interrupted download by running wget -c “followed-by-the-download-link”.

echo Command

The echo command works on Windows and Linux and outputs or prints anything you type inside the terminal. Programmers use the word print to specify an action that shows text on a program or screen.

For example, if you type: “echo hello world” without the quotes and hit enter or return, the terminal will output the words hello world on the following line. It’s a terrific way to show off your command line skills to your friends, but it also has practical uses, like informing the user that a command has finished.

45-Easy-Linux-Commands-Every-User-Should-Know-Inner-03
Source: https://www.geeksforgeeks.org/echo-command-in-linux-with-examples/

alias Command

If you have specific commands you run regularly but are lengthy and hard to type, then it’s time to create aliases for them!

The alias command gives hard-to-type Linux commands a friendlier name so that you can be more efficient, much like a macro command.

For example, it would be easier to install applications by just typing one word, right? Open a new terminal, type “alias apt=’sudo apt-get”, and hit enter. Close and re-open your terminal. Now the system will interpret the word apt as sudo apt-get.

whereis Command

If you want to find the location of a specific program on your system, simply use the whereis command. Type “whereis sudo” and the system will return the exact location of the program.

whatis Command

The whatis command can explain what the command you’re running is. Like the whereis command, the whatis displays information for the command you type after the word whatis. For example, whatis sudo.

whoami Command

If you’re managing many systems from a single terminal (yes, you can do that), then the whoami command is very beneficial. It returns basic user information so you know which system you’re working on. This also works on Windows and Linux.

cd Command

From the terminal, you can also navigate to folders, open files, extract compressed files, etc. The cd command is critical to navigating the system files and directories. The cd stands for change directory and works by typing the command, followed by the folder you want to navigate.

An example would be: cd home.

ls Command

The ls command is another crucial command used on Linux. Navigate to a folder with the cd command. If you type just the ls command, it will list all the files and the directories in that folder.

The ls command supports many other options to display files and folders how you like them.

mkdir Command

The mkdir command derives from the make a directory, and as you probably guessed, it creates folders from within the terminal! To use the command, navigate to your desired folder, and type “mkdir newfoldername” to create a new folder. Replace newfoldername with your desired folder name.

mv Command

This command is another file editing command found on Linux. The mv command allows you to move a file or folder. Its Windows equivalent is the cut command you do when right-clicking a folder or file in Windows Explorer.

cp Command

The cp command does the same as the copy command found on Windows. It can copy a file or folder to a new location you specify through the terminal.

rm Command

While the above Linux commands are for moving and copying a file/folder, the rm command removes references to objects from the filesystem and doesn’t delete all the directories. You should use this command cautiously, as it can irreversibly delete files from a specific directory. Before running it, ensure you’re in the correct folder.

There are plenty of other arguments or options for this command, with the most noteworthy being the -r (Recursive Deletion).

With the -r added after the rm command; it deletes all the files and folders in the subdirectories recursively of the parent directory.

df Command

This handy command is used to get information about mounted drives. The default information is in bytes, so try using the -h command at the end to display them in megabytes and make them more readable.

mount Command

This command can mount drives on your system. It’s usually for external storage units like optical disc drives and USB flash drives. After mounting the drive, its contents become available to the system from the /mnt folder.

head Command

This and the following command are very helpful when working with larger files. The head command outputs the first 10 lines from a given file, giving you a sneak peek of its contents.

tail Command

Likewise, the tail command brings up the 10 last lines of the file. Keep in mind that this also includes empty lines between the text.

diff Command

The diff command is used to compare two files and show their differences. You can use it on both text and binary files. It’s convenient when you want to see the changes made to a file.

Navigate to the folder containing the two files you want to compare. Type in “diff file1 file2” and hit enter. You will then see the output of the comparison between both files.

pwn Command

The pwd command is probably one of the most basic Linux commands. It prints the absolute path of the current working directory, which can assist you when lost in the file system!

45-Easy-Linux-Commands-Every-User-Should-Know-Inner-06

touch Command

If you want to create or update the last-modified timestamp of a file, then the touch command is for you. This can be useful in ensuring a file has the correct timestamp.

For example, if you’re downloading a file from the internet, you can use the touch command to set the correct file timestamp.

ln Command

With the ln command, you can create links between files on your computer. A hard link is similar to creating a shortcut to a file or folder on Windows. You can use it when you want to keep a file copy but don’t want to use up disk space.

This is helpful when you want to keep a file copy but don’t want it to take up disk space. If you delete the original file, the soft link will still point to it and won’t be deleted.

cat Command

The cat command displays the contents of a file on the terminal, and it’s helpful when you want to view a large file and don’t want to open it up in a text editor.

clear Command

The clear command clears all the terminal text, letting you begin from scratch. This is very practical when you want to start fresh or when you have a lot of text on your screen that’s blocking your view. To use the clear command, type “clear” and hit enter.

chmod Command

The chmod command – changes the permissions of a file or folder. It can be used to give read, write and execute permissions to a user, group or everyone. To use the chmod command, type in “chmod” followed by the permissions you want to set.

For example, chmod 777 myfile will give everyone read, write and execute permissions. An excellent tool to help you understand all the permission types is Chmod Calculator.

chown Command

The chown command changes the owner of a file or folder. It can give ownership to a user, group or everyone. To use the chown command, type in “chown” followed by the new owner. For example, chown john song.mp3 will give John ownership of the file song.mp3.

ping Command

The ping command tests the reachability of a host on an IP network. It sends a series of request packets to the host and waits for a response packet.

If the host is reachable, a response packet returns and the time it took to return will be displayed in milliseconds (ms). This can help when troubleshooting network issues or issues with a specific domain.

zip Command

The zip command is convenient for compressing files into a zip archive. It’s efficient when you want to send a lot of files over email or when you want to save disk space.

To use the zip command, type in “zip” followed by the name of the archive. For example, zip test.zip will create a zip archive called test.zip.

unzip Command

On the other hand, you can use the unzip command to extract files from a zip archive. To unzip a file, type “unzip”, followed by the name of the archive. For example, unzip test.zip will extract all of the files from the archive test.zip into the current working directory.

tar Command

An alternative to .zip is the format called tar which is mainly used on Linux operating systems. You can extract multiple archives with the tar command, but the command has many other useful options, like the -c, to help create a new archive.

dd Command

Engineers created the dd command to convert and copy files from different file system formats. We use it to create bootable USB drives for Linux, but it has many other valuable features. For instance, you can back up an entire hard drive to another location.

ps Command

This command works on Windows as well as on Linux. It lists all the running processes in the system. This way, you can use it along with the following command.

45-Easy-Linux-Commands-Every-User-Should-Know-Inner-04

kill Command

With this command, you can stop an application. You can use it simply by typing “kill” followed by the PID (Process ID) of the process you want to terminate, for example, kill 14566. Although the wording might seem abrupt, its primary purpose is to stop processes from running.

killall Command

The killall command will kill all the active processes, but you can still specify which process you want to terminate. For instance, you can type “killall browser” to terminate any process with the name browser.

history Command

If you want to check your prior commands without scrolling up your terminal, use the history command. This works on Windows, too.

useradd Command

All operating systems support multiple users, and Linux is no different. With some very handy commands like the useradd, you can add a new user to your machine.

The most straightforward command would be: “useradd HostPapa -d /home/HP”. The -d command specifies the home directory of the user. You can change it to whatever you like, which can be helpful if you create user accounts for more important collaboration projects.

userdel Command

To delete a user account, use this command, followed by the username.

usermod Command

When you need to modify an existing user, the usermod command is what you need. You can change any value like permissions, groups, etc.

passwd Command

This command lets you create passwords for the users you created, but only if you’re a system administrator. You can only change your account password if you’re not an administrator.

hostname Command

The hostname command displays or changes the system’s hostname. This is the name in a Linux system’s “Hostname” field. To view the current hostname, type “hostname in the terminal.

To change the system’s hostname, type: hostname newname. Where newname is the new hostname that you want to set.

ifconfig Command

To check and modify a network interface, you can use the ifconfig command. You can view the status of a network interface, enable or disable a network interface, set an IP address, and much more.

To view the status of all network interfaces, type “ifconfig”. To disable a network interface, type: ifconfig <interface> down. To enable a network interface, type: ifconfig <interface> up.

ssh Command

The ssh command is a powerful networking tool that allows users to connect to remote systems securely using the ssh protocol.

It can log in to servers, copy files between systems, and execute commands on remote machines. By default, the ssh command uses a secure encrypted connection, making it a safe way to access sensitive data.

When you have your ssh set, you can connect to the remote system by typing “ssh user@remote_system”. You will be prompted for your password and then logged in to the remote system.

exit Command

The exit command terminates a session and exits from the shell.

When you run the exit command, it will close all open files, terminate all running processes, and log you out of the system. This can be useful when you need to temporarily leave the system or have finished working on a project and want to disconnect from the server.

The exit command will close the terminal window if you work in a desktop environment.

shutdown Command

The shutdown command is an essential one to know in Linux. It allows you to shut down or restart your computer. To use it, just type “shutdown” followed by the desired option.

How to Get the Most Out of Linux

Before we reach the end of this article, here’s our take on how to get better on Linux. The short answer? Practice makes perfect! But there are some tips we can give you to accelerate that process.

45-Easy-Linux-Commands-Every-User-Should-Know-Inner-05
Source: From the installation guide: https://linuxmint-installation-guide.readthedocs.io/en/latest/install.html

Using the operating system more over time, you’ll get used to all its elements, making it easier to return and work. While the Linux commands we showed above are a great start to your new journey, let’s consider what else you can do to excel in Linux.

  • Start using shortcuts: Shortcuts are fantastic in every operating system and software. Learning to navigate the operating system and doing actions without using the mouse in the GUI is faster, and once you realize it, you won’t want to stop!
  • Use TAB as an autocomplete in the terminal. This works great when looking for files or folders. If a file has a confusing name, type a couple of its first letters and hit TAB to autocomplete it in the terminal. This also works on Windows and is an excellent tip to learn.
  • Separate your home folder from your OS drive: This is a crucial step you can make before installing Linux on your computer. With new Linux versions coming twice a year, you may want to try them all. But not all upgrades go smoothly, and you might need to start fresh. Splitting your drive into multiple partitions allows you to save your personal files from accidental deletion and re-install an older version of your Linux distribution. This makes the procedure harmless and hassle-free. Consider reading your Linux distribution manual for details.
  • Try a different GUI for your Linux Desktop: Unlike Windows, you can completely change the graphical user interface to another. For instance, Ubuntu already has six different desktop versions you can try. Installing a new desktop environment is done through the terminal. For example, you can type: sudo apt install xfce4 to install the popular Xfce desktop environment. Some of these have advantages you might find interesting, so give them a try or read about them online before making a choice.

With these tips, you can get a good headstart on your Linux operating system, but remember that you can learn hundreds of more tips and tricks by using the system yourself.

“Sudo Conclusion”

Linux is a developer-friendly operating system with loads of programs available through the command line and outside of it. The most significant advantage is that Linux is free to use and open source, so it grabs the attention of many users and not only programmers.

Professionals, especially in the web hosting industry, use Linux on their systems as it’s customizable, flexible, and runs more efficiently than other solutions. Linux server vs Windows server is a very common versus that comes up online, and we have a blog post analyzing the advantages and weaknesses of both operating systems. At the same time, the famous Google Android OS runs on the Linux kernel, and it’s created to work nicely on touch screens and battery-powered devices like smartphones.

This blog post covered many aspects of the most popular Linux commands, and we believe it’s an excellent insight for beginners, while more advanced users can surely take a few notes. These Linux commands are straightforward, and some are even used in complicated tasks. So make sure you bookmark this page to return at any time!

Enjoyed this post? Join our HostPapa blog for more articles like this. Web hosting has never been this good! Get your web hosting plan from HostPapa today!

Julia Keys

Julia is a Content Coordinator for HostPapa, with a special focus on editing copy and all things blog-related. In her spare time, she enjoys reading, watching Oscar-nominated movies, and drinking iced lattes.

No Comments

Sorry, the comment form is closed at this time.