top of page

Moving around Linux

  • Writer: cesfyofficial
    cesfyofficial
  • Aug 9, 2018
  • 3 min read


In the previous tutorial we showed you the directory structure of Linux systems, understanding this directory structure is important not only to find the files we need but also to traverse this structure to get to the desired directory. To see the current directory we are in, aptly named the working directory, and to change the working directory some commands are present along with the commands for creating and maintaining (deleting and editing) files within those directories.


In this tutorial we will explore some of the basic commands that are used to traverse within the directory structure. One would wonder why we need such commands in the first place, why not just use the GUI to go to the file location directly and manipulate our files there. Well the answer lies in the fact that some custom flavors of linux do not have a GUI at all. Even if we do employ a flavor with a GUI it is not necessary that the tools we are trying to use have a GUI of their own and may require us to use the terminal. And most importantly, system maintenance often requires us to remotely access a server and not only monitor services but also configure them.


All these points show that is not only useful but essential that one has a certain level command over the terminal if he/she wants complete control over the operating system and get the required task done efficiently, let us now move on to some of the basic commands that Linux users need to know to at-least find their way around directories.


pwd stands for ‘present working directory’ and is a command used to find out the current directory we are in. Sure the current directory can always be seen printed in the terminal, so why use this then? Well being human users we can see that but a program cannot. If we wish for the program we are making to know the directory it is installed or operating in we use this command and use the output accordingly.


ls derived from the word ‘list’, as the name shows it lists all the files and directories present in a directory. This listing is very useful if the user has no idea what the contents of a folder are.


cd ‘change directory’ is a command used to change the directory we are present in. We can either go into a child directory from a parent directory, go back to the parent directory of the current directory or jump to another directory directly on a completely different path. This is the main method of moving within directories when the terminal is being used.


less is a command that lets us view a file directly in the terminal. This command is faster than text editors because it only reads the start of the file at first, and does not load all of it. This might not be as apparent in faster systems but running on a slow system this can come in handy. The less command Is considered a powerful version of the more command because it allows to go back as well as forward in a file.


touch command is used to make files in a file system. This command only allows us to make a file that we can update with another program. This command is usually used to create files required by a program and do not contain any content by default.


mkdir is a command that is used to make folders for any number of reasons into which files can be stored.


mv and cp are commands that are used to move and copy files to and from directories. And as the names show, moving files deletes it from the directory it is moved from and copying does not. One additional use of the mv command is the renaming of files. This is done my moving the original file to the same location but with a different name.


Finally, rm and rmdir are commands that are used to ‘remove’ the files and directories from the system.


Conclusion:

These are the linux commands used to traverse the file system of linux. These are essential for the proper maintenance and control of linux systems so practice these well to get a hang of their use, they sure can be intimidating at first but using them is the best way to shake the fear off so learn well and don’t forget to play around with them and have fun. Just be sure not to accidentally delete your important data!



Sources:

http://aindien.com/wp-content/uploads/2016/09/linux12.png

https://www.digitalocean.com/community/tutorials/basic-linux-navigation-and-file-management

Recent Posts

See All

Comments


bottom of page