UNIX Terminal Commands Whoami, Where, When, What the Bleep Am I

UNIX Terminal Commands Whoami, Where, When, What the Bleep Am I

UNIX terminal commands Whoami, Where, When, What the bleep am I doing now? #whoami bla #pwd bla #date; time; cal; cal 2006 bla #^D Ctrl+D close the terminal! #blabla Nothings happen….. Navigating and Searching the File System #pwd pwd (print working directory) Where You Are # pwd --help # cd /usr/bin cd (change directory) Moving to Different a space is here! # cd .. Directories # cd at home ! # find /bin -name ls -print Searching Directories for # find /bin -name ‘*ls*’ -print Matching Files Reading Directories and Files [Ctrl+D, Ctrl+U, Ctrl+H] ls (list directory) # ls # ls -F # ls -aF Listing Directories with # ls -l the ls # ls /usr/bin # ls /usr/bin a* # ls > f1 create the file f1 # cat f1 cat (concatenate file) Listing and Combining # date >f2 Files with the cat # cat f1 f2 > f12 # cat f12 # ls –l /bin > f1 create the file f1 Browsing Files with the using your cursor # less f1 less or more keys or ^B or ^F. # head f1 #head -2 f1 bla, bla, bla head and tail # tail f1 # mkdir temp Creating Directories with # mkdir temp2 temp3 temp4 the mkdir # mkdir temp/child Prof. Cezar Bruma Whoami_UNIX_FEDORA.doc printed 10/29/2006 UNIX terminal commands # mkdir temp5/child Woops!!! …. # rmdir temp2 Woops!!! … # rmdir temp5 Try tree temp5. Removing Directories # rmdir temp5/ child with the rmdir This is tricky # rmdir temp* dangerous… Why? # ls /bin > f1 create the file f1 # rm f1 deleting f1 # ls > f1; date > f2; rm f1 f2 Deleting Files with the rm This is tricky # ls > f1; date > f2; rm f? dangerous… Why? This is tricky more # ls > f1; date > f2; rm f* dangerous… Why? # ls > f1; mv f1 f2 f1 will be f2 Renaming Files with the # mkdir temp; mv temp temp1 temp will be temp1 mv # ls > f1; date > f2; cp f1 f2 f1 remains Copying with the cp # mkdir temp; cp temp temp1 temp remains # ls>f1; ls –l; chmod +x f1;ls -l Changing attribute with for files # chmod g-x f1; ls -l chmod # mkdir t; ls –l;chmod –x t; ls –l for directories Superuser is the boss! # ls > f1; cp f1 t Woops…. # ls > f1; ln -s f1 f2 symbolic link is Creating Symbolic Links merely a pathname, with the ln # ls -l f* or alias, to the original file. # whereis date # ln –s /bin/date ddd # ddd # ls /bin | head Pipe # ls /bin | tail output | input # ls /bin | wc # tar -cvf - ./dir | gzip -9c > arhiv.tgz packaged Creating Archives with # gunzip -c arhiv.tgz | tar -xvf - packaged the tar and gzip/ungzip # gunzip -c arhiv.tgz | tar -tvf - view Using the Shell The shell provides the interface to Linux so you can run programs. # cat /etc/passwd | grep student csh, bash, tcsh,rsh,.. my using SHELL # builtins for tcsh # alias Prof. Cezar Bruma Whoami_UNIX_FEDORA.doc printed 10/29/2006 UNIX terminal commands # cat > bob The computer waiting… date ls To end, type Ctrl+C cal or Cntr+D ^D # cat bob # bob Woops …. # ./bob Woops …. # chmod +x bob # ./bob This is ! Script command! Vi editor (universal UNIX editor) ADVICE1: If you do not know what to do click on Esc key! Then on u key (this is undo key). Till this advice will be the wrong one! ADVICE2: Think and try, NOT try and think. l one character right h one character left j one line down k one line up x delete character dd delete line i insert text (insert mode) a append text Esc Return to command mode :wq write and quit :q! quit without changes Try a few more commands u Æ undo Ctrl+f Æ forward :/abba Æ search abba G Æ end file 3x Æ delete 3 characters Ctrl+b Æ backward 0 Æ line begin wd Æ delete a word Ctrl+D Æ 1/2 forward 7G Æ go to line 7 :w! Æ write only Exercises (home work) Command What is it? Comments # ls --help # ls -a ls –a versus ls ? # ls –rt ls –rt versus ls –tr # ls –s /bin # ls –srtF /bin # cal 2006 # cal 2006 > f1; wc f1 # cal 2006 | grep A Make a script command with a lot of commands and play it. This is the fun part of the UNIX! # cal > f1 Use vi and write a file like f1 and name it f2 # diff f1 f2 You must receive … nothing on output. diff (difference) Prof. Cezar Bruma Whoami_UNIX_FEDORA.doc printed 10/29/2006 UNIX terminal commands Prof. Cezar Bruma Whoami_UNIX_FEDORA.doc printed 10/29/2006 .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    4 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us