Using the Shell Department of Computer
Science and Engineering
Linux for Devices
Module-3, Lecture-1
By: Dr. A K Yadav (9911375598)
Dept of CSE, ASET, AUUP
Using the Shell Department of Computer
Science and Engineering
• The program used to interpret and manage commands is referred to as the
shell
• Shell are independent of Linux distribution
• It provides a way to create executable script files, run programs, work with
file systems, compile computer code, and manage the computer
• The Linux distribution you are using has more than one shell installed by
default and available for your use.
• We will focuses primarily on the bash shell because the Linux distributions
Fedora and Red Hat Enterprise Linux, both use the bash shell by default
Department of Computer
Science and Engineering
• The shell is a command language interpreter.
• There are several ways to get to a shell interface in Linux.
• Three of the most common are the
Shell prompt
Terminal window
Virtual console
Department of Computer
Science and Engineering
• Choosing Your Shell
• Running Commands
• Recalling Commands Using Command History
• Command-line completion
• Command-line recall
• Connecting and Expanding Commands
• Piping between commands
Department of Computer
Science and Engineering
• Sequential commands
• Background commands
• Expanding commands
• Expanding arithmetic expressions
• Expanding variables
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Moving Around the Filesystem Department of Computer
Science and Engineering
Linux for Devices
Module-3, Lecture-2
By: Dr. A K Yadav (9911375598)
Dept of CSE, ASET, AUUP
Moving Around the Filesystem Department of Computer
Science and Engineering
• Linux Filesystems versus Windows-Based Filesystems
• Using Basic Filesystem Commands
• Using Metacharacters and Operators
• Using fi le-redirection metacharacters
• Using brace expansion characters
• Listing Files and Directories
Department of Computer
Science and Engineering
• Identifying Directories
• Understanding File Permissions and Ownership
• Changing permissions with chmod (numbers)
• Changing permissions with chmod (letters)
• Setting default fi le permission with umask
• Changing file ownership
• Moving, Copying, and Removing Files
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Working with Text Files Department of Computer
Science and Engineering
Linux for Devices
Module-3, Lecture-3
By: Dr. A K Yadav (9911375598)
Dept of CSE, ASET, AUUP
Working with Text Files Department of Computer
Science and Engineering
• Exploring the Text Editors
• Editing Files with vim and vi
Adding text
Moving around in the text
Deleting, copying, and changing text
Pasting (putting) text
Repeating commands
Exiting vi
Department of Computer
Science and Engineering
• Skipping around in the file
• Searching for text
• Using ex mode
• Learning more about vi and vim
• Finding Files
• Using locate to find files by name
• Searching for files with find
• Finding files by name
Department of Computer
Science and Engineering
• Finding files by name
• Finding files by user
• Finding files by permission
• Finding files by permission
• Using not and or when finding files
• Finding files and executing commands
• Searching in files with grep
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Managing Running Processes Department of Computer
Science and Engineering
Linux for Devices
Module-3, Lecture-4
By: Dr. A K Yadav (9911375598)
Dept of CSE, ASET, AUUP
Managing Running Processes Department of Computer
Science and Engineering
• Understanding Processes
• Listing Processes
• Listing processes with ps
• Listing and changing processes with top
• Listing processes with System Monitor
• Managing Background and Foreground Processes
• Starting background processes
Department of Computer
Science and Engineering
• Using foreground and background commands
• Killing and Renicing Processes
• Using kill to signal processes by PID
• Using killall to signal processes by name
• Setting processor priority with nice and renice
Listing and changing Department of Computer
processes with top Science and Engineering
Listing processes with Department of Computer
System Monitor Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Writing Simple Shell Scripts Department of Computer
Science and Engineering
Linux for Devices
Module-3, Lecture-5
By: Dr. A K Yadav (9911375598)
Dept of CSE, ASET, AUUP
Department of Computer
Science and Engineering
• Understanding Shell Scripts
Executing and debugging shell scripts
Understanding shell variables
Special shell positional parameters
Reading in parameters
Parameter expansion in bash
Performing arithmetic in shell scripts
Using programming constructs in shell scripts
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Linux Files Department of Computer
Science and Engineering
Linux for Devices
Module-3, Lecture-6
By: Dr. A K Yadav (9911375598)
Dept of CSE, ASET, AUUP
Linux Files Department of Computer
Science and Engineering
• The File Structure
• Home Directories
• Pathnames: Absolute and Relative
• System Directories
• Listing, Displaying, and Printing Files
• Listing Files: ls
• Displaying Files: cat, less, and more
• Printing Files: lpr, lpq, and lprm
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Linux Directories Department of Computer
Science and Engineering
Linux for Devices
Module-3, Lecture-7
By: Dr. A K Yadav (9911375598)
Dept of CSE, ASET, AUUP
Linux Directories Department of Computer
Science and Engineering
• Managing Directories:
Creating and Deleting Directories
Displaying Directory Contents
Moving Through Directories
Referencing the Parent Directory
• File and Directory Operations:
Searching Directories
Searching the Working Directory
Department of Computer
Science and Engineering
Locating Directories
Copying Files
Moving Files
Copying and Moving Directories
Erasing Files and Directories
Links
• The mtools Utilities
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Linux Archives Department of Computer
Science and Engineering
Linux for Devices
Module-3, Lecture-8
By: Dr. A K Yadav (9911375598)
Dept of CSE, ASET, AUUP
Linux Archives Department of Computer
Science and Engineering
• Archiving and Compressing Files:
Archiving and Compressing Files with File Roller
Archive Files and Devices: tar
Displaying Archive Contents
Creating Archives
Extracting Archives
Updating Archives
Archiving to Floppies
Compressing Archives
Archiving to Tape
Department of Computer
Science and Engineering
• File Compression:
Compression with gzip
Compressing with bzip2
Using Zip
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering
Department of Computer
Science and Engineering