Linux was created by a Software Engineer named Linus Torvalds. Linux is a “family of open source Unix-like operating systems based on the Linux kernel” — Wikipedia. The first Linux kernel was written in 1991. The Software layers used to describe the Linux structure are as follows:
. The kernel — Runs the hardware and allocates resources.
. The shell (Which I will focus on here) — Where you type commands into the CLI (Command Line Interface).
. Applications layer — Where programs run, such as GCC (Gnu Compiler Collection) and vi (a popular text editor).
Linux Operating System hierarchy
In most operating systems including Linux, directories (aka. folders) are structured in a hierarchical tree-like way. This keeps our files and folders organized. The root directory is labeled as a forward slash ‘/’ character, all other directories sit below the root. When you first log in you will be taken to the home directory.
Linux file system tree
The following is a list of some of the most common Linux shell commands (each command will be followed by /$ which is just an example of being in the root directory of the terminal):
/$ ls - List storage. This command will list the contents of the current directory you're in.
/$ cd - Change directory. This will bring you to your home directrory. To navigate up a level use cd.., back a directory cd -, to root cd /, or if you have it follow a path it will bring you to that directory, for example
/$ pwd - Print working directory. Outputs the path of the current working directory starting from the root. Example output /home/jay/photos .
/$ mkdir - Make directory. Short for make directrory, will create a new directory when followed up with a name that the user types (must be all lower case), for example mkdir myfiles.
/$ touch - Mainly used to create new empty files touch myfile.
/$ rm - Remove. This command is mainly used for removing files and directories. Use this with caution as there is no trash bin in Linux.
/$ mv - Move. Moves file(s) from one directory to another mv file1.txt file2.txt, also can be used to rename a file mv name newname.
/$ echo - Outputs lines the user types in front of it as string arguments echo "Hello World!". This command is usually used in shell scripts and batch files.
/$ grep - Global Regualr Expression Print. My favorite, this is a very useful command that can be used to search for string charcaters in a file. When it finds the characters you're searching for it will output the result grep "hello" greeting.txt.
Originally published at https://coderjay06.github.io on September 24, 2020.