SOME BASIC COMMANDS EVERYONE SHOULD KNOW IN LINUX

A lot of people assume that Linux is a technical operating system, too technical for average users, however, since the earlier 2000’s it’s safe to say that most modern distributions and desktop environments have improved and are becoming more user friendly. All that said, linux users still should know a bit about the terminal and how much faster it can make certain day to day tasks. In this article, I’ll cover a small fraction of the useful commands that a user might want to use every day to gain system information, find out where in the file system they are located, update their system, manage services, do simple cleaning of cache resources and so on. Linux is not your regular Windows operating system, but with a basic knowledge, most users can find a way to make it work for them. Linux is a Unix like operating system, this means it’s closer related to Mac OS, however, unlike Mac, there are no hidden backdoors.

When choosing an operating system, most new linux users opt for Ubuntu, but a majority of the following commands can be used in all distributions. I’m running Manjaro currently, however, you can find a similar command or use the same one in your distribution to find out more information. Linux separates the root and standard user accounts by default, unless you’re in debian, you kind of have to add a separate account in Debian in which you will have to log in each time you want to upgrade or install software. That’s the eaasiest solution for me, but it’s a good one. Most distributions do add the regular user to the wheel if you use the same password for both accounts. By doing this you are closer to the root user, you still have to add a password to use the root account, but you do get added security that random programs can’t automatically run as root if ran by the regular user. Windows has a similar option for this to Debian. If Windows users recall, since at least XP they’ve been urged by many tech savvy friends to use separate accounts. This was for security.

Linux hides nothing and many distributions give you a leg up with either gui or cli applications to handle the heavy load for you. Linux also has man pages to help when searching for information on a command. The following commands will give you some examples and act as a starting point for anyone on any distribution to learn more. I am in no way an expert, however, these are rudimentary level commands so..

Command

Description

uname -r

Gathers information about kernel, can have different flags such as a or n see man uname.

pwd

Display the current working directory.

cd

Change directory. Have to follow with a slash and/or just the directory name.

whoami

Which user you are.

netstat

Displays network and port information, can be replaced with ss.

ls

List the contents of the directory.

lsblk

List block devices connected to system.

ifconfig, iwconfig

Similar to Windows ipconfig.

cat

List contents of file.

man

Access the man pages.

updatedb

Updates the file index, usually done automatically.

find

Add a file name or type plus directory to locate file.

clear

Clears the terminal screen.

which

When program is passed in argument, it shows the location of the program.

In addition to these basic commands, there are others that are good to know. The following lists a few important string style commands that use the root account to function. Most of these are either for maintenance or updating the system.

Command (Str)

Description

sudo apt-get update && sudo apt-get dist-upgrade -yy

Used in conjunction to update a system and it’s repositories in Ubuntu. Will not work in Arch(More on this soon). The &’s let bash know that you want to run the two together.

sudo rm -r

Is often used to clean a directory of all contents including files and folders.

sudo systemctl reboot

On modern systems, this reboots the machine.

sudo systemctl daemon-reload

Updates the status of systemd without rebooting.

sudo ufw status, enable, reload, disable

Controls the working state of the simplified firewall that interfaces with the underlying iptables.

sudo systemctl restart service

Used to control service states on systemd systems.

sudo rsync $dir1 $dir2

Copies contents of directory 1 to directory 2.

As you can see, once you know a few of these commands, Linux is no longer that scary. You can use this as a reference or cheat sheet for as long as you need. These are just a few of the many commands for Linux. Once you have a grasp of these, you could carry on with business without learning too many others. This is just a good place to start. I wager that most users would want to learn more though. Got a favorite command? Let me know!

Update:

For those who want a little more learning, here’s a few other commands that might be useful!

Commands

Description

free -h

Shows memory usage in human readable format.

df -h

Shows disk space usage in human readable format.

uptime

Shows uptime for user in number of days hrs and minutes. Also shows current load average.

Leave a Reply