Exploring Your Linux System

These are my notes and thoughts on finding your way around your Linux system.

Samsung Store on Amazon! If you buy something, I get a small commission and that makes it easier to keep on writing. Thank you in advance if you buy something.

Ls Command

The ls command is one of the most used commands. It lists directory contents. It will quickly become second nature. We can see directory contents and other information about files. It is used like this:

Ls

We can specify a directory:

Ls /Music

We can see more detail like this:

Ls -l /Music

 

As with almost all commands, there are options and arguments you can use with them. These options and arguments modify how the commands work. An option is usually a dash followed by a single character. These are called short options. There are also long options that do the same thing in most cases. A long option is two dashes followed by a word. You can even use more than one option at a time. So we can do things like:

Ls -a

Ls -h

Ls -ah

Options in Linux are case sensitive. It can be easy to forget this so keep it in mind. 

 

CD Command

The cd command lets you move around your system. It changes directories.

Once we look at our current location with the ls command, we can change to a directory that is listed there if we want to.

Ls

I am still in my home directory but I see a Music folder. What’s in there I wonder? Let us see.

Cd Music

Ls

Well, there isn’t anything in there yet. I need to fix that soon. I like music like everyone else. Hopefully you can see how this is helpful. Cd also has other things it can do like move backward one file level.

Cd ..

ls
Now, you see that you are back where you started. That is the basic usage for the cd command. It is enough for now.

 

File Command

The file command gives you the file type of the file you are looking at. 

File .bashrc

This shows you it is a text file. Since there are many types of files it is not always obvious what kind of file you are seeing. 

 

Less Command

The less command lets us look at text files and see a smaller portion. This is helpful when the file in question is many pages long. We look at text files so we can modify them. An example would be a file that controls settings. Another reason is that program code is text and that is how we make programs. We can use it like this:

Less .bashrc

We can now scroll up and down. I do not recommend changing anything yet, but you need to know how to examine a file. Files are how settings are done in Linux so it is important to know about. 

Type q to exit the less program

 

Symbolic Links

While you are exploring your system, you might see something that looks pretty weird after you use ls to view a directory’s contents. This is called a symbolic link. In fact, you can identify these symbolic links because they start with an <l>. This special file is also called a soft link. A soft link is like a pointer to a real file. It is useful because a program can change the pointer instead of countless versions of the file itself. This lets your system be much more efficient.