Linux

Contents

  • What is Linux?
  • Who uses it?
  • Architecture
  • Directory Structure
  • Shell
  • Commands

Linux

  • Family of free and open-source software operating systems built around the Linux kernel (Fedora, Ubuntu, Red Hat etc.)
  • Best-known and most-used open source operating system​ kernel
  • History of Linux
    • Created by Linus Torvalds in 1991
    • Linux is modelled *after* Unix, it is not derived *from* Unix.
    • Unix for mainframes, Linux for PCs.

Who uses it?

  • Almost every Big company i.e. Facebook, Amazon, Google, eBay etc.
  • 95% of supercomputers
  • 75% stock exchange
  • Your mobiles etc.

Architecture

Kernel

  • The central part of an operating system
  • manages the operations of the computer and the hardware - most notably memory and CPU time.
  • thought of as the program which controls all other programs on the computer
  • There are two types of kernels:
    • A microkernel, which only contains basic functionality;
    • A monolithic kernel, which contains many device drivers.

Shell

  • The shell accepts human readable commands and translates them into something the kernel can read and process.
  • bash(Bourne Again shell), ksh, tcsh and zsh
  • Terminal - program that opens a window and lets you interact with the shell.
  • Shell Prompt

    There are various ways to get shell access:
    • Terminal -  X Terminal (XTerm), Gnome Terminal (GTerm), or KDE Terminal (KTerm) application.

    • Connect via secure shell (SSH) 

Basic Command Line Editing

 

  • CTRL + L : Clear the screen.
  • CTRL + W : Delete the word starting at cursor.
  • CTRL + U : Clear the line i.e. Delete all words from command line.
  • Up and Down arrow keys : Recall commands (see command history).
  • Tab : Auto-complete files, directory, command names and much more.
  • CTRL + R : Search through previously used commands (see command history)
  • CTRL + C : Cancel currently running commands.
  • CTRL + T : Swap the last two characters before the cursor.
  • ESC + T : Swap the last two words before the cursor.
  • CTRL + H : Delete the letter starting at cursor.

Users and Permissions

 

  • Linux is a multi-user operating system
  • User in the system is uniquely identified by a numerical number called the UID
  • The root is superuser - has all rights to all files, system services, and softwares.
  • Permissions - needs to protect users from each other
  • You can create user groups to manage accesses
  • Permissions: Read - Write - Execute

Sudo

  • "Superuser do"
  • Running commands with root user permissions
  • sudo allows a permitted user to execute a command as another user, according to specifications in the /etc/sudoers file.
  • sudo requires that users authenticate themselves with a password
  • sudo can log both successful and unsuccessful attempts
  • To edit the sudoers file, use the visudo command.
  • Once a user has been authenticated, a timestamp is recorded and the user may use sudo without a password for a short period of time
  • Use: prepend to any command

Basic Commands

  • pwd - To know which directory you are in
  • Is - to know what files are in the directory you are in. You can see all the hidden files by using the command “ls -a”
  • cd - Use the "cd" command to go to a directory
  • mkdir - create a folder or a directory
  • rm - to delete files and directories. Use “-r” option to delete a directory
  • touch - used to create a file
  • cp - copy files. It takes two arguments: The first is the location of the file to be copied, the second is where to copy
  • mv - Use the mv command to move files through the command line. We can also use the mv command to rename a file.

Intermediate Commands

  • echo - helps us move some data, usually text into a file
  • cat - Use the cat command to display the contents of a file. It is usually used to easily view programs.
  • df - Use the df command to see the available disk space in each of the partitions in your system.
  • du - Use du to know the disk usage of a file in your system. If you want to know the disk usage for a particular folder or file in Linux
  • tar - Use tar to work with tarballs (or files compressed in a tarball archive) in the Linux command line.
  • zip, unzip - Use zip to compress files into a zip archive, and unzip to extract files from a zip archive.
  • chmod - Use chmod to make a file executable and to change the permissions granted to it in Linux.

Ubuntu

 

  • Free and open source operating system and Linux distribution based on Debian
  • Ubuntu is offered in three official editions:
    • Ubuntu Desktop: for Personal computers
    • Ubuntu Server: for servers and the cloud
    • Ubuntu Core: for Internet of things devices. 
  • PPA: A Personal Package Archive (PPA) is a software repository for uploading source packages to be built and published as an Advanced Packaging Tool (APT) repository by Launchpad(web application that allows users to develop and maintain software).
  • APT - works with core libraries to handle the installation and removal of software on Debian, Ubuntu

Package managing

  • apt: Use apt to work with packages in the Linux command line. Use apt-get to install packages.
  • This requires root privileges, so use the sudo command with it.
  • To install - sudo apt-get install ...
  • sudo apt-get update - update your repository each time you try to install a new package.
  • You can upgrade the system by typing “sudo apt-get upgrade”

Directory Structure

Questions?

References

  • https://www.thegeekstuff.com/2010/09/linux-file-system-structure
  • https://thegeeksalive.com/linux-directory-structure-explained/
  • https://en.wikipedia.org/wiki/Ubuntu_(operating_system
  • https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
  • https://www.computerhope.com/unix/sudo.htm
  • https://diyhacking.com/linux-commands-for-beginners/​

Thank You

Made with Slides.com