Linux Commands for Beginners Part 1: Beginner Linux AdministrationBy Roman Rafacz
The goal of this article is to help introduce new users to the basics of Linux. After reading this article you will have an understanding of how the Linux system is structured, where files and directories are located making it easier for you to navigate around, giving you a better idea of how your systems works. We’ll then move on to some basic Linux navigation, copy, showing your files and directories, etc.
Whether you’re new to Linux or are looking into getting some type of certificate, you’ll need to have some basic knowledge of the Shell, the Kernel, the Terminal, and FHS, among others. There’s actually quite a bit of other things you’ll need to know, but let’s start with the basics.
The Kernel is what controls everything on a system; think of it as the heart of Linux. It performs tasks that create and maintain the Linux environment. The Kernel receives instructions from the shell and engages the appropriate hardware (processors, memory, disks, enforces security, etc.). It is a bridge between applications and the actual data processing done at the hardware level.
The shell is the interface between you and Linux. We issue commands through the command line interface which is interpreted and passed on to the kernel for processing. When we log onto the computer the shell will automatically start. It will then monitor the terminal for any commands.
This is the Terminal (command line interface).
There are a number of shells you can use, each differing slightly. Most Linux distros use Bourne-Again shell(bash) but support various others: Korn Shell, Bourne shell, C shell, etc. For all intensive purposes you can just stick with bash but I will show you how to change this if you want to. As you advance you can use shells to create scripts to automate tasks, making your daily routine all the more easier.
Filesystem Hierarchy Standard
Next important aspect is the FHS. Everything in Linux is either a file or a directory. The Filesystem Hierarchy Standard (FSH) is the way that these files and directories are structured. More importantly though is how they are structured. Looks intimidating at first glance but when you realize that there is a method to this madness, you will find it’s so much simpler because everything is organized in the proper place and you can find where you want go much easier.
/ – The root directory. This is where your directory structure starts. Everything is housed under the root directory.
/bin – Essential user command binaries used for general operations: Copy, show directory, etc. (ls, cp, and cat – we’ll get to these commands soon)
/boot – Static files of the boot loader. Files here are necessary for a Linux system to start (Kernel & GTUB information)
/dev – Where the device files are located
/etc – Configuration files for all programs. Things like an apache web server, users & groups on your system, or printer configuration. Think of this as a control panel for Windows users. We will edit these text files later (These files should remain static and text based).
/home – Home directories for all the users to store personal files (i.e. /home/roman) –Windows equivalent of Documents & Settings.
/lib – Essential shared libraries and kernel modules
/media – Mount point for removable media
/mnt – Temporary mounted file systems
/opt — Add on application software packages – (i.e. Program files for windows users)
/sbin — Essential system binaries
/tmp – Programs write their temporary files here.
/usr – Multi-user utilities & Applications. It contains application source codes, documentation, & config files they use. It’s the largest directory on the system.
/var – Variable data on a system. Data that will change as the system is running (Log files, backups, cache, etc.)
/root – Home directory for root
/proc – Virtual directory containing process information (system memory, hardware configuration, devices mounted, etc.)
The directories that I would be most concerned starting off are /etc, /home, /dev, /mnt. As your skills progress you’ll venture off into other areas, but I started out in /etc 95 percent of the time. There are directories that extend, but we’ll get those later.
Navigation & Issuing Commands
The first thing you want to do is open a terminal. Depending on the distribution you are using this may differ but you should find it in Utilities. Since you are new to Linux, I recommend downloading a distro and trying it Live without having to install. Check out the blog’s Linux section and our list of Linux distros.
Let’s start with some basic commands
pwd – Print working directory will tell you what directory you are in.
Notice that I used pwd to tell me where I am & I used cd (change directory) to move into another folder.
cd – Change Directory. Can be used with “/” & then the folder you want to go to. For example, cd /home/roman will take me to the directory that exits for user Roman.
ls – Lists files & directories that you are in.
It may help to use the ls command to list what files and directories exist in the directory you are in. It’s vital to know the difference between ls & pwd. pwd tells you where are, ls tells you what you have to work with.
whoami – Tells you which user is logged in
You’ll notice I used the su command to change from user roman, to root, then to igby, though igby does not exist. I then used “exit” to go back to user roman.
su – Substitute user. There are some rules and additional features that we’ll explore on the next lesson.
Let’s go to your home directory and finish off a few other commands. For me it will be cd /home/roman.
Let’s make a file and delete it.
touch – A command you can use to quickly create a file that you can also “touch” on existing files (We’ll dive into that later)
You’ll notice that “createfile” wasn’t there before but when I used it with the “touch” command it was created. Nothing is in createfile but it exists.
rm – Removes the file for you
clear – Clears the terminal for you
Those are some of the basic commands. There are plenty more where that came from. Hopefully this article has been informative and insightful. The next article will follow up on this one with more information on Linux as well as commands to really get you going.
About the Author
Roman Rafacz is the product of Western Illinois University’s prestigious academics programs. With a BS in Instructional Technology and a BA in Communications Roman has taken his education and applied it into the vast world of Information Technology. Roman currently works for Jack Morton Worldwide and is a Technical Administrator for the IBM training facility in the Chicago Loop. Roman has been working at Jack Morton for two years and is consistently engulfing himself in different technologies that IBM has to offer. While pursuing higher education through certifications such as A+ and Net + he also enjoys life outside of the computer world with ultimate frisbee, synchronized swimming, and fantasy football.
- Linux Command Line 101
- How to Set Up Safe FTP in Linux
- How to Install and Use SSH (Secure Shell) in Ubuntu
- How to Create a Separate Home Partition in Ubuntu Linux
- Basic IOS Commands for Routers and Switches
- 5 Cisco IOS Commands Every Network Admin Should Know
- CompTIA Linux+ Certification Overview
- Introduction to Python Programming in Ubuntu Linux
- Top 9 Linux Productivity Tips and Tools
- Top 7 Linux Open Source Development Tools