Linux

Linux, just like Windows, iOS and Mac OS, is an operating system. It manages all the hardware resources on your computer and acts as a bridge between your software and hardware. Without the operating system, the software would not be able to function properly. 

Interestingly, Android, one of the most widely used platforms in the world, is powered by the Linux operating system. So, if you're using an Android device, you're essentially using a device that runs on Linux.

To manage our files, we can use:
1. Terminal (Command Line Interface-- CLI)
2.  File manager (Graphical User Interface –GUI)

Advantages of Using Command-line Interface

  • If you're familiar with commands, a CLI can be more efficient than other interfaces and easily handle repetitive tasks.
  • A CLI uses less memory and CPU processing time than other interfaces.
  • A CLI can be used on any operating system and requires fewer resources while maintaining precision.

Workings On Linux Terminal

  1. To Open the Linux terminal we can either go to the dashboard and type terminal or press CRLT+ALT+T.
  2. Once the terminal is launched many things can be seen.
  3. The first part of this line is the name of the user (guru)
    The second part is the computer name or the hostname. The hostname helps identify a computer over the network. In a server environment hostname becomes important
    ':' is a simple separator
    The tilde '~' sign shows that the user is working in the home directory. If you change the directory this sign will vanish
  4. The command "cd" is used to change path. And ~ sign does not display while working in /bin directory. It appears while moving back to the home directory.
  5. '$' sign suggests that you are working as a regular user in Linux.  
    While working as a root user,  '#' is displayed

Present Working Directory

The directory that you are currently browsing is referred to as the Present Working Directory. By default, the PC logs on to the home directory when it is booted. To determine the directory you are presently working on, you can use the command "pwd". "pwd" command stands for print working directory.


Changing Directories

To change the current directory, use the 'cd' command.



Navigating to Home Directory

  • To navigate to the home directory, type the command cd
  • Can also use the cd ~ command

Moving to Root Directory

Linux denotes the root of the file system using '/'. In contrast to Windows, which uses the backward slash "\", UNIX/Linux utilizes the forward slash "/". To access the root directory, type 'cd /'.

It's important to remember to include a space between "cd" and "/", otherwise you may encounter an error.

Navigate through multiple directories at the same time by specifying its complete path.
Instead, we can type '/dev/cpu' to reach the directory directly.

Moving up one directory level

To navigate up one directory level, use the command 'cd ..'. This will move you up from the current directory to the parent directory. For example, if you are in the '/dev/cpu' directory, using the 'cd ..' command will take you up to the '/dev' directory. You can then use the same command again to move up to the root directory (i.e. '/').

Relative and Absolute Paths

There are two types of paths:
1. Absolute Path
2. Relative Path

Path in computing is the address of a file or folder.

Absolute Path

An absolute path is defined as specifying the location of a file or directory from the root directory(/). In other words, we can say an absolute path is a complete path from the start of the actual filesystem from the / directory.


If you see all these paths started from the / directory which is a root directory for every Linux/Unix machine.

Relative Path

Relative path comes in handy when browsing another subdirectory within a given directory
Saves from the effort to type complete paths all the time. We Do not have to specify the complete path to reach a specific location within the same directory in the file system.

Accessing Hardware Information

  • Disk Space Usage: <df -h> displays the mounted filesystem disk usage. Also, try out <lsblk>
  •  
  • Memory: <free -h> display the RAM and Virtual Memory information. You can also use 
  • <cat /proc/meminfo> 

  • CPU Details: <lscpu> or <cat /proc/cpu> display the information related to CPU.

  • Peripheral Component Interconnection(PCI) Devices: <lspci>, displays the PCI devices list and its information.

  • All the above information and more can be viewed with the single command <lshw> as well.