1 / 19

Linux Commands

Linux Commands. Prepared by: Dr. Bahjat Qazzaz. Using UNIX Commands Special Characters. The UNIX shell interprets a number of characters in special ways. These characters are most often used with UNIX commands - as arguments and for other means.

duena
Télécharger la présentation

Linux Commands

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. Linux Commands Prepared by: Dr. BahjatQazzaz

  2. Using UNIX Commands Special Characters • The UNIX shell interprets a number of characters in special ways. • These characters are most often used with UNIX commands - as arguments and for other means. • The following list contains most of UNIX's special characters

  3. Using UNIX Commands: Special Characters NEWLINE - initiates command execution ; - separates commands on same line ( ) - groups commands or identifies a function & - executes a command in the background | - pipe > - redirects standard output >> - appends standard output < - redirects standard input * - wildcard for any number of characters in a file name ? - wildcard for a single character in a file name

  4. Using UNIX Commands : Special Characters \ - quotes the following character ' - quotes a string preventing all substitutions " - quotes a string allowing variable and command substitution ` - performs command substitution [ ] - denotes a character class in a file name $ - references a variable { } - command grouping within a function

  5. Using UNIX Commands . - executes a command (if at beginning of line) # - begins a comment : - null command

  6. Using UNIX Commands • Examples • Use the * character in file names to match any number of characters. The following command: ls *.txt Will match the following files: • chapter1.txt doc.txtmemo.txta.txt Will not match the following files: doctxttxt.memo

  7. Using UNIX Commands • Use the ? character in file names to match any single character. The following command: ls ???.txt Will match the following files: one.txtdoc.txttwo.txt Will not match the following files: chap1.txt doctxt

  8. Using UNIX Commands Use the [ ] characters in file names to match any character within a range of characters. The following command: ls chapter[1-3].txt Will match the following files: chapter1.txt chapter2.txt chapter3.txt Will not match the following files: chap1.txt chapter4.txt

  9. Using UNIX Commands: Terminal Control Keys Terminal Control Keys • Several key combinations on your keyboard usually have a special effect on the terminal. • These "control" (CTRL) keys are accomplished by holding the CTRL key while typing the second key. For example, CTRL-c means to hold the CTRL key while you type the letter "c". • The most common control keys are listed below:

  10. Using UNIX Commands: Terminal Control Keys CTRL-u - erase everything you've typed on the command line CTRL-c - stop/kill a command CTRL-h - backspace (usually)   CTRL-z - suspend a command CTRL-s - stop the screen from scrolling CTRL-q - continue scrolling CTRL-d - exit from an interactive program (signals end of data)

  11. Using UNIX Commands: Getting Information • Getting Information • The "man" command • The "man" command man gives you access to an on-line manual which potentially contains a complete description of every command available on the system. In practice, the manual usually contains a subset of all commands. • man can also provide you with one line descriptions of commands which match a specified keyword • The online manual is divided into sections:

  12. Using UNIX Commands: Getting Information Section Description ------- ----------- 1 User Commands 2 System Commands 3 Subroutines • Devices • File Formats • Games • Miscellaneous • System Administration l Local Commands n New Commands

  13. Using UNIX Commands: Getting Information Examples of using the man command: • To display the manual page for the cp (copy files) command: man cp--More--23% at the bottom left of the screen means that only 23% of the man page is displayed. Press the space bar to display more of it or type q to quit.

  14. Using UNIX Commands: Getting Information • By default, the man page in section 1 is displayed if multiple sections exist. • You can access a different section by specifying the section. • For example: • Keyword searching: use the -k option followed by the keyword. Two examples appear below. man -k mail man -k 'copy files'

  15. Using UNIX Commands: Getting Information To view a one line description of what a command does: whatis more will display what the "more" command does: more, page (1) - browse or page through a text file

  16. Using UNIX Commands who - shows who is on the system who who am i finger - displays information about users, by name or login name finger doe finger userid whoami- show your userid

  17. Using UNIX Commands clear - clear the screen wcnew.login- count the lines, words and characters in the new.login file wc -l new.login- count just the lines

  18. Using UNIX Commands cp .login testfile ; cat testfile copy a file and then show its contents ls -l testfile ; rmtestfile; ls -l testfile list (long) a file, remove it, and then try to list it again

  19. Using UNIX Commands

More Related