Getting Familiar with the Basics of Linux
When starting out on your Linux journey, there are a few concepts that are keys to working with Linux successfully. In this article, we take a look at some of them including how space is organised in Linux, some basic shell prompts that are useful to know that come in handy with everyday tasks.
Tree Structure of the Linux File System Hierarchy
Linux organizes its space as a file system hierarchy starting with the root folder. All other subfolders are nested inside this root folder (denoted as a / in the figure below). This can be visualized as a tree structure. All users have their own folder under the home folder. When you first start the Linux shell prompt, you are asked to setup a username and password. This becomes your default directory or home directory for all future use.
Use this Linux shell prompt to print the current working directory
To explore and view the contents of your working directory
Use this shell prompt to navigate to the a specified path in the tree structure.
$ cd /foldername
To go up one level in the tree structure use the following.
$ cd ..
Basic Shell Prompts for common File tasks
Use the following to make a new directory.
$ mkdir directoryname
To create a file use the command
cat > filename . Press
enter to add file content. Use
ctrl+ d to escape back into shell prompt.
$ cat > filename
press enter to type file content here
// ctrl+ d to escape back into the shell prompt
To view the contents of a file use
cat filename .
$ cat test.txt
test content shown here
To remove a file or directory use
rm filename .
$ rm filename