Useful Linux Commands

One of my favorite parts about Linux is the command line interface. Also known as the shell, terminal, or console. It might be intimidating at first for some people but it will become a powerful tool once you understand it. Also I think it’s fun but I might be a nerd. But in order to use the command line interface you need to know some Linux Commands to get you started.

Linux Logo

I’v been wanting to do a post like this for probably a year but I kept putting it off because there are so many commands and it seemed overwhelming. But I decided maybe a smaller list of useful commands divided into types would work and be more useful anyway. So here is my attempt.


Linux Commands to get info about other commands

I’ll start with the “man” command. It’s short for manual and If this was the only Linux command you knew then you could probably figure out how to do most things with some time.

All you do is type man and the command you want to learn about after that.

man ls

Or you could type “man man” to learn more about the man command itself.

If you want to list all the man pages on your system you can do that with this command.

man -k .

Probably the next most important Linux commands to know is how to navigate around the file system with the command line.

List Files and Folders

“LS” will list all the files and folders in your current location. To see hidden files add “-a” to the end of it.

ls -a

To see permissions you can add a “-l” or just combined the two flags to see hidden files and permissions with “-al”.

Change Directory

Or in other words change what folder you are in. Type in “CD” followed by the folder name to go into that folder. Or add a “..” after the “CD” to go back one folder.

cd FolderName
cd ..

Create a Folder

If you need to make a new folder just use the make directory command followed by the name you want to give the folder.

mkdir "My New Folder"

Delete File or Folder

There are a few ways to do this but I always use the “RM” command.

rm FileToDelete.txt

You can add a “-r” to delete a folder and everything in it.

rm -r "Old Folder"

If you wanted to play it a little safer you can use “rmdir”. This will only work if the folder is already empty.

rmdir "Old Folder"

Create a file

If you need to make a file you can use the “touch” command.

touch newFile.txt

But most likely you will want to do more with the file. So I skip the “touch” command and just open a simple text editor called nano. Every Linux distro I have tried has had nano installed so I think this will work everywhere.


or open a file with nano.

nano newFile.txt

Move or Rename a file

The MV command is used to both move and rename files.

To move a file you would point to the file you want to move then the location you want to move it to from the current working directory.

mv file1.txt /myFolder

To rename a file you just point to the file you want to rename then type the new name after it.

mv oldFileName.txt newFileName.txt

Copying files in bulk

There are two ways to copy a large amount of files. The rsync command and the DD command. Both of these commands can get complicated so I will refer you to the pages I have dedicated to them.

Computer Backup With Rsync

Creating a Bootable USB Drive with dd

File and Folder Permissions

There are two commands to work with file system permissions in Linux. CHOWN and CHMOD.


CHOWN changes the owner of a file or folder. To hit all files and folders under the folder you target give it the recursive flag “-R”.

The first name before the “:” is the owner and the second name is the group.

chown -R root:root folder


CHMOD uses the owner information to adjust what can be done with that file or folder. This one can be a little tricky to wrap your head around. To hit all files and folders under the folder you target give it the recursive flag “-R”.

chmod -R 774 folder

The first number is the owners permission. The second number is the group permission. The 3rd number is permission for everyone else.

And here is a table of what each number means. R = Read. W = Write. X = execute. The dash means none.

0 = —
1 = –x
2 = -w-
3 = -wx
4 = r-
5 = r-x
6 = rw-
7 = rwx

So a 777 would give everyone read write and execute permission while a 444 would give everyone read only permissions.

Find a File or Folder

If you need to do a search you can use the find command. the -name flag is case sensitive and the -iname flag is case-insensitive. You can also use * as a wild card.

The command is formatted like this:

find (location to search) [flags] (filename or part of name)

In this case I am using ./ to search the folder that I’m in for anything that contains the word “server”.

find ./ -iname *server* 

Linux Commands to Updating Your System

The next most useful thing I think would be updating your system.

For Debian Based Distros

There are 2 commands to know to update Debian based distros. The first two are:

apt-get update
apt-get upgrade

The first one updates the database and the second runs the update. This will keep your system updated. But once in a while you might need to run this next one.

apt-get dist-upgrade

This will attempt to intelligently handle changing dependencies with new versions of packages and remove older packages if needed. While apt-get upgrade will not remove anything. So at some point if dependency changes updates might stall unless apt-get dist-upgrade is used.

For Arch Based Distros

Arch based distros has 2 main commands for updating as well.

sudo pacman -Syy
sudo pacman -Su

The first command updates the database and the second command performs the updates.

Installing Packages

Coming soon.

Uninstalling Packages

For Arch Based Distros

The most basic command would be:

sudo pacman -R (package)

But for a more complete uninstall you can do something like this.

sudo pacman -Rcns (package)

-R is the remove part.

-c removes anything that depends on the target package.

-n is for “no save”. This stops any backup of the package from being made.

-s remove dependencies this package had. Be careful with this one because a dependencies can be used by more then one package.

If there looks like there might be a problem then you can remove the -c and add a -u.

-u tell it to only remove packages that are not needed by anything else.

sudo pacman -Runs 

Checking Disk Space

It’s not as easy to see disk space without a fancy GUI but there are Linux commands that tell you how much space you are using and what you have free. I like using “df -h”. Adding the “-h” at the end makes the sizes more friendly to read. But some systems do this automatically.

df -h

If you want to see the size of folders in your current directory you can use the “du – h” command.

du -h

As a bonus you can use this command to tell you what file system the disk is formatted in.

df -T

Date and Time

An easy way to see the current date and time on your system is to just type “date”.


To set a new date and time you can use the “-s” flag and a string after that. The format is “year-month-day hour:minute:second”

date -s "2022-05-22 08:20:00"

More to come

I will probably keep adding to this list or maybe make a part two. Commands keep coming to mind and I want to try to take the time to explain them well. So we will see how this evolves.

But for now I wanted to get this posted before this month runs out.

Leave a Reply

Your email address will not be published. Required fields are marked *