Linux Commands and File System
Linux commands syntax consist of options and arguments. The syntax is command option(s) argument(s).
- Change the way a command works.
- They contain a hyphen or dash followed by a letter.
- Some commands can have multiple options which can be clubbed together after a hyphen.
- They are used along with multiple arguments.
- Some commands take arguments automatically if none is provided.
- They are not mandatory for some commands while needed by others
command --options/switches argument
The commands which are used frequently are,
cd stands for change directory. It is used to navigate around the file system.
pwd stands for Present working directory. It used for getting the current working directory.
ls stands for a listing of directories/files of the current directory.
man command stands for manual. It gives a manual page for the specific commands.
clear command is used to clear the Linux terminal.
cat command is used to read the contents inside a file.
Let's learn these commands in detail in the upcomming articles.
There are three types of help commands. They are what is command, command --help and man command.
Linux vs Windows Commands
Some of the Linux vs Windows commands are listed below:
Path completion is a very helpful feature in any operating system. It is made to speed up your typing speed. You just have to hit the 'Tab' key and your command, option, or file name that is arguments will be automatically completed or will give you the options.
For example, if you want to type 'cd Downloads' you can type 'cd Do' and hit Tab. Your command will be automatically completed since there are two folders that start with Do they are Documents and Downloads.
But to work the Tab key you have to type the first letter correctly. For example, if you will type 'cd do' followed by the Tab key then you won't get any result as there will be no files starting from 'do'.
Path completion is extremely helpful in typing long file names where you don't remember the full file name. Some files contain symbols or spaces which is difficult to keep in mind where you can use them.
In Linux, the file structure shows the way in which the files are named and where the files are logically placed and can be used for retrieval.
The different directories in a Linux file system are listed below:
- / - Root directory of the entire file system hierarchy.
- /boot - It is the system reserved file. All the files related to booting are in this file.
- /root - It is the home directory for the root user. It is not similar to /.
- /dev - It contains the files for peripheral devices that are attached to the Linux system.
- /etc - It contains the configuration files.
- /bin -> /usr/bin - It contains the common user commands.
- /sbin -> /usr/sbin - It contains the commands for the root user.
- /opt - The optional add-on application software are saved here.
- /proc - It contains the text files related to the virtual file system and process status.
- /lib -> usr/lib - It contains essential shared libraries and kernel modules.
- /tmp - It contains temporary files.
- /home - This directory is designed for users.
- /var - The data which changes dynamically for every reboot is stored here.
- /run - It contains the temporary runtime files like the process id files.
- /mnt - It is the mount point for temporarily mounted file systems.
- /media - mount point for removable media.
The file is the collection of data items stored on a disk. In Linux, everything is stored in the form of files.
A directory consists of a group of files. There are two types of directories they are,
- Root directory : There is only one root directory in your system, which is denoted by "/". It is the parent or the root of your entire file system and it has control over all the users, files, and directories.
- Subdirectory : The directory under the parent directory(/) is called the subdirectory.
Linux supports numerous file system types they are,
- EXT2 : It is a UNIX-like file system. It has the concepts of blocks, inodes, and directories.
- EXT3: EXT3 is the updated version of the EXT2 file system. EXT2 enhanced with journaling capabilities. Journaling allows fast recovery of system files when the system encountered a crash.
- EXT4: It is the extended version of EXT3. Some of the features of EXT4 are compatibility,multi-block allocation, journaling checksumming, creation of larger file sizes, etc..,
- ISOfs(iso9660): It is the worldwide standard of ISO used by CDROM file system.
- Sysfs(System file system): It is a ram based file system initially based on ramfs files. It is used to export the kernel objects so that the end-user can use it easily.
- Procfs(process file system): This file system acts as an interface to internal data structures in the kernel. It can be used to obtain information about the system and to change certain kernel parameters at runtime using
Linux File Types
Linux file types symbol and their meanings are listed below:
||Device or special file.