Lecture 8 Linux


Linux is a powerful and open-source operating system known for its flexibility, security, and the active community that supports it. It is widely used in various domains, from servers to personal computers and embedded systems.

  • Operating System: Linux is an open-source operating system kernel, originally created by Linus Torvalds. It serves as the foundation for various Linux distributions or "distros" that include additional software and tools.
  • Open Source: Linux is open-source software, meaning its source code is freely available for anyone to view, modify, and distribute. This openness encourages collaboration and innovation.
  • Variety of Distributions: Linux comes in various distributions (distros) like Ubuntu, CentOS, Debian, and Fedora. Each distro may have unique features and package management systems.
  • Multi-User and Multi-Tasking: Linux is a multi-user and multi-tasking OS. Multiple users can use the system simultaneously, and it can run multiple processes concurrently.
  • Command-Line Interface (CLI): Linux offers a powerful command-line interface, allowing users to interact with the system through text commands. The terminal is a key tool for configuration, automation, and administration.
  • Graphical User Interface (GUI): Many Linux desktop environments, like GNOME and KDE, offer graphical interfaces for users who prefer a visual way to interact with the system.
  • Security: Linux is known for its robust security features. User and file permissions, firewall settings, and robust security practices help protect the system from vulnerabilities.
  • Package Management: Linux distros use package managers (e.g., apt, yum, and dnf) to install, update, and remove software. This simplifies software management and updates.
  • Server and Desktop Use: Linux is widely used for both server and desktop applications. It's the foundation of many web servers and powers various embedded systems and IoT devices.
  • Community and Support: Linux has a vast and active user community, offering support through forums, documentation, and online resources. Commercial support is also available for certain distros.
  • Licensing: Most Linux distributions use the GNU General Public License (GPL) or similar open-source licenses, ensuring that the software remains open and freely available.
  • Customization: Linux is highly customizable. Users can tailor the OS to their specific needs, from the kernel configuration to the desktop environment.
  • Compatibility: Linux supports a wide range of hardware architectures, making it versatile and suitable for various devices.
  • Educational Value: Learning Linux is valuable for IT professionals and hobbyists. It provides skills in server administration, scripting, and system management.
  • Ecosystem: Linux has a thriving ecosystem of applications, tools, and software for various purposes, making it a versatile choice for a wide range of tasks.

CLI (Command Line Interface)

  • The Linux CLI offers a powerful and flexible way to interact with the operating system, and it's an essential skill for system administrators, developers, and power users.
  • Terminal Emulator: To access the CLI in Linux, you typically open a terminal emulator program. Common terminal emulators include GNOME Terminal, Console, and term.
  • Commands: Users interact with the system by entering text-based commands. These commands are usually made up of a command name and various options and arguments.
  • File System Navigation: The Linux CLI is often used to navigate the file system, view directories, list files, create, delete, and manipulate files and directories.
  • User Management: Administrators can create, modify, and manage user accounts through the CLI. Commands like "useradd" and "passwd" are used for user-related tasks.
  • Package Management: Package managers like "apt," "yum," or "dnf" are used to install, update, and remove software packages. These package managers are operated through the CLI.
  • System Configuration: Configuration files and system settings can be modified using text editors or specialized configuration tools in the CLI.
  • Scripting: The CLI is a powerful environment for scripting and automation. Bash, a popular shell, is often used for scripting tasks.
  • Remote Access: SSH (Secure Shell) allows users to access remote systems through the CLI securely. It's commonly used for server administration.
  • Help and Documentation: Most CLI commands provide built-in help using the "--help" option. The "man" command offers detailed manual pages for most commands.
  • Customization: Users can customize their CLI experience by configuring the shell prompt, aliases, and environment variables.
  • Wildcards: Wildcards like "*" and "?" are used to match multiple files or characters, making it easier to work with groups of files.
  • Redirection: Operators like ">", ">>," and "|" are used to redirect input and output, allowing users to manipulate data flow in various ways.
  • Text Processing: The CLI is adept at text processing. Commands like "grep," "sed," and "awk" are commonly used for searching, filtering, and manipulating text.
  • Administrative Tasks: System administrators rely on the CLI for tasks such as monitoring system performance, managing services, and troubleshooting issues.
  • Root Access: Some operations, particularly system-level tasks, require superuser (root) privileges, which can be obtained through the "sudo" command.

Terminal
CTRL + ALT + T


CLI launching.

1. First part of this line is the name of the user (guru)
2. Second part is the computer name or the host name. The hostname helps identify a computer over the network. In a server environment host-name becomes important
3. ':' is a simple separator
4. Tilde '~' sign shows that the user in working in the home directory. If you change the directory this sign will vanish

  • In the above illustration we have moved from the /home directory to /bin using the 'cd‘ command
  • ~ sign does not display while working in /bin directory. It appears while moving back to the home directory.
  • '$' sign suggests that you are working as a regular user in Linux.  
  • While working as a root user, '#' is displayed.

Changing Directory using cd command

  • we moved from directory /tmp to /bin to /usr and then back to /tmp





Navigating to Home Directory

To navigate to the home directory, type the command cd.







Moving to root directory

Root of file system in Linux is denoted by '/'.






Navigate through multiple directories at the same time by specifying its complete path.






Relative and Absolute Paths

Two kinds of path - Absolute path and relative path
Path in computing is the address of a file or folder.

Windows - C:\documentsandsettings\user\downloads
Linux- /home/user/downloads

Absolute Path





Relative Path

Directly typing the path.







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 above information and more can be viewed with the single command <lshw> as well


Comments

Popular posts from this blog

Lecture 2 - Fetch, Execution and IO

Lecture 11 Linux Network and Process Management

Lecture 12 Clint Server Architecture