Introduction to Linux (Oct 8, 2023)

 Lecture D02(Introduction to Linux)



Linux is an operating system, the same as Windows, iOS, and Mac OS. 
In reality, Linux is the operating system that runs one of the most widely used systems on earth, Android. 
An operating system is a piece of software that controls all of the hardware resources connected to your desktop or laptop. Simply explained, the operating system controls the connection between your program and hardware. The software wouldn't run without the operating system (OS).
the most common PC tasks are generating, transferring, and removing files.
You have two options for managing your files: 

  1. File Manager (Graphical User Interface, or GUI) 
  2. Terminal (Command Line Interface, or CLI).
Despite the trend toward GUI-based systems, CLI still has its benefits and is frequently employed in server management and scripting.


reasons to learn command line interface?
Some interesting uses - Commands are more versatile and, in comparison, give more alternatives. Although extremely powerful, piping and stdin/stdout are unavailable in GUI.
Some GUI setups can span up to five screens, whereas a CLI configuration only requires a single command.
While moving and renaming thousands of files in the GUI takes time (using Control/Shift to select numerous files), regular expressions in the CLI allow for the completion of the same work with only one command.
CLI loads quickly and uses less RAM than GUI. When things become tight, this matters.
launching on Ubuntu.


Launching on CLI
- Go to the Das and type terminal or you can press CTRL + ALT + T 
- Once CLI (Terminal) is launched, you will find something as guru99@VirtualBox(see image) written on it

Launching CLI on Ubuntu.

  • The user's name (guru) appears. 
  • The hostname or computer name is the second component. The hostname aids in the network identification of a computer. A server environment makes the hostname vital.
  • A basic separator is ":"
  • The user displays the home directory with the tilde ('') symbol. This indicator will disappear if the directory is changed.
  • The '$' sign suggests that you are working as a regular user in Linux.  While working as a root user,  '#' is displayed
  • Using the 'cd' command, we went from the /home directory to /bin in the example above.

**While operating in the /bin directory, the symbol is not displayed. When returning to the home directory, it manifests

The present working dictionary
Active Directory at the moment
  • When the computer boots, log in to the home directory because it is the directory you are now browsing.
  • Using the command - pwd, you may find out the directory you are currently working on.
  • The print working directory (pwd) command
  • the directory we are working on is /home/guru99.

Changing directories

  • You may use the 'cd' command to change the current directory.
  • we switched between the directories /tmp, /bin, and /usr before returning to /tmp.
Navigating to the home directory
  • To navigate to the home directory, type the command cd
  • Can also use the cd ~ command

to move to the root dictionary


  • '/' in Linux stands for the file system's root. comparable to Windows' "c:"
Note: Windows uses a backslash (""), but UNIX/Linux uses a forwardslash ("/"). Type "cd /" to get to the root directory.

**Keep in mind to add a space between "cd" and "/." Otherwise, a mistake will occur.

Moving to the root directory

  • You can navigate multiple directories by supplying a directory's full path.
             Example:  There is no requirement to split the process into two steps when moving the /cpu                     directory under /dev.
  • Instead, we may use the command line to access the directory by typing '/dev/cpu'.
Relocating one directory level up
  • 'cd..' can be used to move up a directory level.
  • The directory is relocated from '/dev/cpu' to '/dev' using the 'cd..' command in this case.
  • The directory hop from "/dev" to the "/" root directory is accomplished by executing the same command once again.
Relative and Absolute paths 


Two kinds of path - Absolute path and relative path
Path in computing is the address of a file or folder
Example -
Windows - C:\documentsandsettings\user\downloads
Linux- /home/user/downloads
Example: Let's say you have to browse the images stored in the Pictures directory of the home folder 'guru99'
The absolute file path of Pictures directory /home/guru99/Pictures
To navigate to this directory, you can use the command 
 cd /home/guru99/Pictures, it is called absolute path because the full path is specified to reach the file
A relative path is when looking via a different subfolder within a particular directory, relative paths are useful.
avoids having to constantly spell out whole pathways.
Let's say you are right now in your Home directory. You may just write cd /home/guru99/Downloads to get to the Downloads directory instead of typing the whole path.

Accessing hardware information

Disk Space consumption: The mounted filesystem's disk consumption is shown via the df -h command. Try out lsblk as well.
 
Memory: Free -h displays details on the RAM and Virtual Memory. Additionally, you may use "cat /proc/meminfo" 

CPU Specifications: The commands lscpu and cat /proc/cpu reveal details about the CPU.

Peripheral Component Interconnection (PCI) Devices: The command lspci shows the list of PCI devices and their details.

The single command "lshw" also allows you to examine the information mentioned above and more.

Comments