14 Jan Introduction to Linux Basics
Linux is a free, open-source operating system. Linux has been under active development since 1991. It has evolved to be versatile and is used all over the world, from web servers to cellphones. However, newcomers to Linux may find it difficult to approach the structure of an unfamiliar operating system.This guide gently introduces key terminal skills and equips newcomers to learn more about Linux.
Must Read :- “Linux looks boring. But it not “ Try Linux and see how it is so interesting itself .
Linux filesystems are based on a directory
tree. This means that you can create directories (or “folders”) inside other directories, and files can exist in any directory.
Linux all commands are case sensitive in nature .
To see what directory you are currently
This stands for “print working directory”, and will print the path to your current directory. The output can look similar to this:
This means that your current active directory is backup, which is inside home, which lives in the root directory, /.
To see other files and directories that exist in your current working directory:
This will give you a list of names of
files and directories. To navigate into a directory, use its name:
cd <name of directory>
This will change your new current worki
ng directory to the directory you specified. You can see this with pwd.
Additionally, you can specify .. to change to the directory one level up in your path. To get back to your original directory:
We can also create new directories in our current working directory. For example, to create a new directory called bar:
Then we can
into bar if we want. We can also delete bar if we no longer find it useful:
rm -d barrm –d
will only delete empty directories.
Files cannot be used with
(it stands for “change directory”).
Instead, we can view files. Say we have a file backup in our current directory:
This will print out the entire contents of backup to the terminal.
With long files, this is impractical and unreadable. To paginate the output:
This will also print the contents of backup, bu
ne terminal page at a time, beginning at the start of the file.
Use the spacebar to advance a page, or the arrow keys to go up and down one line at a time. Press q to quit out of less.
To create a new file called DBbackup:
This creates an empty file with the name DBbackup in your current working directory. The contents of this file are empty.
If we decide DBbackup isn’t such a good name after all, we can rename DBbackup to tsp:
mv DBbackup tspmv
stands for “move” and it can move a file or directo
ry from one place to another.
By specifying the original file, we can “move” it to a new location in the current working directory, thereby renaming it.
It is also possible to copy a file to a new location. If we want to bring back DBbackup, but keep tsptoo:
cp tsp DBbackup
Just as you guessed,
is short for “copy”. By copying tsp to a new file called
DBbackup, we have replicated the original file in a new file with a different name.
However, what good is a file if it contains nothing
? To edit files, a file editor is necessary.
There are many options for file editors, all created by professionals for daily use. Such editors include vim, emacs, nano, and pico.
nano is a perfectly suitable option for beginners. It is easy and simple to use, with no bells or whistles to confuse the average user.
To edit text into DBbackup:
This will open up a space where you can immediately start typing to edit DBbackup.
To save the written text, press
then y. This returns you to the shell with a newly saved DBbackup file.
Now DBbackup has some text to view when using
Finally, to delete the e
Unlike directories, files are deleted whether they contain content or not.