1 / 14

Shell

Shell . Current shell. $ ps PID TTY TIME CMD 5355 pts /0 00:00:00 bash 5381 pts /0 00:00:00 ps $ csh $ ps PID TTY TIME CMD 5355 pts /0 00:00:00 bash 5389 pts /0 00:00:00 csh 5409 pts /0 00:00:00 ps. Command compatibility. $ type date

raina
Download Presentation

Shell

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Shell

  2. Current shell $ ps PID TTY TIME CMD 5355 pts/0 00:00:00 bash 5381 pts/0 00:00:00 ps $ csh $ ps PID TTY TIME CMD 5355 pts/0 00:00:00 bash 5389 pts/0 00:00:00 csh 5409 pts/0 00:00:00 ps

  3. Command compatibility $ type date date is /bin/date $ type cd cd is a shell builtin

  4. File system commands • Working directory $cd / $cd /home/class • Absolute and relative paths $cd /home  absolute $cd ..  relative • How to determine current directory? $pwd • Listing the contents of directory $ ls

  5. Create directory $ mkdir grapple $ mkdir –p vehicles/cars/4wds  hierarchy of directories • Remove directory $ rmdir grapple (rmdir removes only empty directories) $ rm –r vehicles (removes all subdirectories and files)

  6. Creating Files $ touch file.txt $ cat>file.txt • Remove files $ rm file.txt • Moving files $ mv file.txt file1.txt $ mv file1.txt /etc/myfiles

  7. Process management commands • Listing processes $ ps PID TTY TIME CMD 5355 pts/0 00:00:00 bash 5381 pts/0 00:00:00 ps $ ps -A PID TTY TIME CMD 1 ? 00:00:04 init 2 ? 00:00:00 keventd 3 ? 00:00:03 kapmd 4 ? 00:00:00 ksoftirqd_CPU0 5 ? 00:00:03 kswapd

  8. Terminating a process $ kill -s SIGTERM 5356 SIGTERM – allows the process to close the files before exiting SIGKILL – forces the process to terminate immidiately.

  9. Switching Identities $ id uid=500(brucewayne) gid=513(users) groups=513(users) $ su Password: bash# id uid=0(root) gid=0(root) groups=0(root), 1(bin), 2(daemon) bash# exit $ id uid=500(brucewayne) gid=513(users) groups=513(users) $ su batman Password: $ id uid=800(batman) gid=513(users) groups=513(users)

  10. Shut down $ shutdown $shutdown –t n • Reboot $reboot • Disk Usage $df  partition by partition summary

  11. Mounting Disks # ls /mnt/cdrom At this stage, no files are listed since there is no device associated with the /mnt/cdrom mount point. # mount /mnt/cdrom # ls /mnt/cdrom RedHat Autorun README # umount /mnt/cdrom

  12. Listing users $who • History command $history 1 ls -al 2 date 3 pwd 4 who 5 touch cellar/maze/labyrinth/passage/foo.txt • $ !2 • date Tue Jan 14 23:03:43 2003Sd

  13. To execute last command $!! • Command completion $da<Tab>  If conflict, it beeps and waits for user input

  14. File Globbing • The asterisk (*) represents zero or more matches of any characters. • The question mark (?) represents a match of exactly one character. • The square brackets ([ ]) match any one of the characters between them. The characters to match may also be specified as a hyphen-separated range of characters to match against • ! Means not

More Related