LINUX CLI TRAINING WHEELS

Linux CLI Training Wheels 

Welcome to my first article ever, on anything! This article is going to cover the basic raw commands to get you moving around the FHS ( File Hierarchical System) that all Linux OS function under.  From one beginner to another, learning the Linux file system can be ridiculously overwhelming and push a beginner into the realm of never touching a Linux system again.  I am here to tell you, if I can navigate the basics, so can you.  I will assume you know what a command prompt is (The scary black screen on Linux OS, and Windows, with no graphics). Also known as the command line, cmd, CLI (command line interface), prompt, console or terminal, it all depends on who you’re talking to.  I am going to do my best to keep this as simple as I can , so let’s get our fingertips dirty and learn some commands.

The first command we will discuss is the pwd command. This is short for print working directory.  This command tells the user in the command prompt where they are working from within the Linux FHS.  The leftmost / (forward slash) is always the root directory and the top dog of the Linux FHS.

This image has an empty alt attribute; its file name is Ntqa-SJaI-cp1JMef9SpA5gV2O7s-SUybcFN-kYpxh37rTbmwgf_YSzZI63_BOYMNjhCrLNaPvIjkw9fy1pyPiThm9Ea9NcGCydNJHYzXKzkX5f4YcKGzLTG2bNWVs8zbnoV6ZA9

Our second command we will be going over is the ls command, which is short for list. This command will output a list to the screen of the directories and file(s) within the directory that you are working in.  Linux users will be using the ls command quite a bit!  A user will need to know what is in the directory which could be files or even more directories, this is where ls command comes to the rescue.  In the screenshot below, we have printed the current working directory ( /home/user ) and requested a list of items within the /home directory.  (Usually, unless tampered with by the user all directories are blue and files and other output is going to be green within the Linux OS).

This image has an empty alt attribute; its file name is sjQXgfG1PCWw74Fgk4jwZnnsTKQAhELOTd91hsrvmmWToDC2dKBoPZEdP6RS0Dn1KLKZtK4KmDVEen2XFwX07DQG09fB0xWZwAC21-H_1FRvPs8Rv8XyqLtYl8_I0au5qjiK5tuZ

Now we are starting to move around a little bit, but how can a user see what is inside of a file within a directory?  In linux to view what is in a file the user needs to be in that directory.  This can be accomplished with the cd command which is short for change directory.  In the screenshot below we went from the user Directory to the Downloads directory. (PRO TIP) Tab complete is your best friend when navigating the FHS. After typing a couple characters of the desired directory hit tab and it should auto fill the rest of the directory you want to move to. 

This image has an empty alt attribute; its file name is edbNTmVk5pQ20TZ-M40lWrIQoVtWJEC6-qiroyQmWYfTY-JqDlQwWKsplE2idMJXpXbVf2ptxXZQDXGJ9X4UAaaBE0iOFfk9sFVakQ336wh5KTiCY9x58eyuAhvh1CH0ssDhw_h6

Now to move back to the home directory cd has a couple of options.  In the screenshot below the user has moved into different directories and moved back to the home directory with these various options.

This image has an empty alt attribute; its file name is iAVjLhNozbrhpeROl3Bs3xkTv5HvKiCG0KiQtSA_nZPQzxslGFa1jCq-1RvoKw0OWPUXFDsaWUUjn0aP6MhTnD3oL6redfBCrKwtCWTwZPUtztks-61O27UvCuUjmZeDU7yMLWnF

Once a user is in a desired directory and can see there are file(s) within the desired directory, the user would most likely want to read the contents of the file.  The command that will make that happen is the cat command, which is short for concatenate.  This command will display the contents of the specified file to the user in the terminal.  The command also has multiple functions like the cd command.  This article shows a  basic overview of the cat command without its added functionalities. Another great feature in Linux are the man pages, as well as the –help command ( A user will double tack full word commands, single tack for single letters ).  These two features are absolute life savers when you are struggling in Linux and do not have access to the web.  First, with the man command we can man man and look at the manual of the man pages in Linux, hang in there!

This image has an empty alt attribute; its file name is 7RfYJItpAeJYq8XKHutlXgBM5sc_FMm_0j6IglWe9CX-zkD-337dokYO3EaE90DZPauMnYC_rWTIPOvOwYFgby7IwTaEzzqsyXj6-Z_qife2Jcon_byck01gfuZ9Js9TxzpTF4WW

Below is the man man command output.

This image has an empty alt attribute; its file name is 0-yDtOHBjcHOvpRmQL-7RmW7f0_uvPDtvVhmUBiZsmrHB3Jh9nrcv2EWmLXxmCuCZbeYiuJOJdgp3GjVmvt2KSfEGyRbv572PFBKxG1rqzKez6fzIYWlTXIJHr8HJAwWcRcqhTsc

There is quite a bit of output here but it is valuable information in learning how to use the man pages of Linux. Now with the –help command you can concatenate this command with any other commands such as cat and ls to get help on how to use those commands.  

I challenge you to explore these options, do a little googling, and research as my professor would say, they are pretty easy to understand and quite useful. 

This image has an empty alt attribute; its file name is RywPfqbPBawfmgpxa8_PKs-dyoGE53MYo3-BPQHx6AUsqkVsnSEcFPhv9NcL7OxJ6poyxGK2K-09Zgj3X128TS-kSvV0VwZHvJSOQro2hZw9YorNXQlCYxeiqTDkCcDt4d4RsnvH



 In the screenshot below we see that the user has moved into the Downloads directory, listed the contents of that directory and we see there is a file named “File_1.txt”, and with the cat command the contents of the file is displayed to the user.

This image has an empty alt attribute; its file name is RmYrocU81WKLVt5BPG5W5CKsDg5fHM0Xpoc5mWDnUzchmj5sOoX3viJO4mmbTScu8JwxLqdLxBtLLpH_iBslT5O-ontNP-RbJiZ15xbbrHOQEigvF5E-RgOtR6h8RzyKVRbZ_Wlp

Now let’s say the file we just looked at is not the greatest file in the world and we want to get rid of it. We can do that with the rm command which is short for, you guessed it, remove.  The rm command will remove the entire file that you request to be removed.  In the screenshot below we have cd into the Downloads directory, opened the text file File_1.txt, read the file with the cat command and decided that the file is not the greatest, and decided to deleted/remove it. 

This image has an empty alt attribute; its file name is Xc2m74_y5oTtVcsdukwQExSOW7ZNgaRa0_K3TRqwInPBECXbZCrCli1nd4hr9JsMf7J-5XaePWPIm0pm1LseUbWbJ0NVlyDzAJ_wiCyz3TtvFObLfBtYaXUflU-zWJXf4MvP45qX

Well, I hope this article helps get your feet wet with some very basic Linux commands and get you moving around the FHS of Linux.  These commands are the tip of the tip of the iceberg when it comes to the commands that are available in Linux. I highly suggest going out on the web and downloading a few Linux command cheat sheets just to have them as a quick reference guide and to study. I would like to share a couple of really great sites that will take this article to the next level. The first one I suggest checking out is Linux Survival.  This one really helped me wrap my brain around the Linux FHS.  The second site I would suggest is Linux Journey. This one is a very user-friendly site and is one of a couple that I am currently in the process of completing.  Thanks for hanging with me.  I’ll see you in the next article where we will peek into the different layers of the previous commands that were discussed.


Chandar Pass

June 11 2021

Hackhouse.net Author