1 / 20

Linux Commands

Basic L inux C ommands Dr. İsmail DEMİR. Linux Commands. Why use Linux. A Linux distribution has software worth thousands of dollars , for virtually no cost Linux operating system is reliable, stable, and very powerful

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. BasicLinux Commands Dr. İsmail DEMİR Linux Commands International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  2. Why use Linux • A Linux distribution has software worth thousands of dollars, for virtually no cost • Linux operating system is reliable, stable, and very powerful • Linux comes with a complete development environment, including compilers, toolkits, and scripting languages • Linux comes with networking facilities, allowing you to share hardware • Linux utilizes your memory, CPU, and other hardware to the fullest • A wide variety of commercial software is also available • Linux is very easily upgradeable • Supports multiple processors as standard • True multitasking. So many apps, all at once • The GUIs are more powerful than Mac! International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  3. The use of computers to analyze, run for biological,Physics, and climate, wheather and etc. problems.” As all data sets have grown larger and problems have become more complex, the requirements for computing power have also grown. Computers that can provide this power generally use the Unix operating system - so you must learn Unix Linux/UNIX has powerful text processing tools which are highly suited to working with sequence data While many tools have Web interfaces, many more are available via the UNIX command line International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  4. Linux directories • /bin System binaries, including the command shell • /boot Boot-up routines • /dev Device files for all your peripherals • /etc System configuration files • /home User directories • /lib Shared libraries and modules • /lost+found Lost-cluster files, recovered from a disk-check • /mnt Mounted file-systems • /opt Optional software • /proc Kernel-processes pseudo file-system • /root Administrator’s home directory • /sbin System administration binaries • /usr User-oriented software • /var Various other files: mail, spooling and logging International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  5. File and Directory management cd Change the current directory. With no arguments "cd" changes to the users home directory. cd <directory path> ls List contents of a directory. Ex: ls, ls –l , ls –al, ls –ld, ls –R (-rwxrwxr-x 1 juan juan 0 Sep 26 12:25 foo) |more will list page wise mkdir Make a directory. Ex: mkdir <directory name> : Makes a directory Ex mkdir –p /www/chache/var/log will create all the directories starting from www. International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  6. 3 types of file permissions – read, write, execute 10 bit format from 'ls l'command 1 2 3 45 6 7 8 9 10 file type ownergroup others eg. Drwxrwr means owner has all three permissions, group has read and write, others have only read permission read permission – 4, write – 2, execute 1 eg. Rwxrw-r--=764 673 = rw-rwx-wx International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  7. chmod Change the file permissions. Ex: chmod 751 myfile : change the file permissions to rwx for owner, rx for group and x for others Ex: chmod go=+r myfile : Add read permission for the group and others (character meanings u-user, g-group, o-other, + add permission,-remove,r-read,w-write,x-exe) Ex: chmod +s myfile - Setuid bit on the file which allows the program to run with user or group privileges of the file chown Change owner. Ex: chown <owner1> <filename> : Change ownership of a file to owner1. chgrp Change group. Ex: chgrp <group1> <filename> : Change group of a file to group1. International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  8. cp Copy a file from one location to another. Ex: cp file1 file2 : Copy file1 to file2 Ex: cp –R dir1 dir2 : Copy dir1 to dir2 mv Move or rename a file or directory. Ex: mv <source> <destination> International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  9. find Find files (find <start directory> -name <file name> -print) Ex: find /home –name readme -print (Search for readme starting at home and output full path.)“/home" = Search starting at the home directory and proceed through all its subdirectories "-name readme" = Search for a file named readme "-print" = Output the full path to that file Ex: find /home –name readme 2>/dev/null International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  10. sed stream editor for filtering and transforming text Usage: sed [OPTION] [inputfile]... eg. sed 's/love/hate/g' loveletter.txt bg – make a foreground process to run in background Usage: type 'ctrl+z' and then 'bg <job id>' fg – to make background process as foreground process Usage: fg [jobid] jobs – displays the names and ids of background jobs Usage: jobs International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  11. pwd Print or list the present working directory with full path. rm Delete files (Remove files). (rm –rf <directory/file>) rmdir Remove a directory. The directory must be empty. (rmdir <directory>) touch Change file timestamps to the current time. Make the file if it doesn't exist. (touch <filename>) whereis Locate the binary and man page files for a command. (whereis <program/command>) which Show full path of commands where given commands reside. (which <command>) International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  12. who – show who is logged on Usage: who [OPTION] eg. who , who b, who q ps – report a snapshot of the current processes Usage: ps [OPTION] eg. ps, ps el kill - sends a signal to a process or process groupYou can only kill your own processes unless you are root Usage: kill [OPTION] pid eg. kill 9 2275 International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  13. File viewing and editing emacs Full screen editor. pico Simple text editor. vi Editor with a command mode and text mode. Starts in command mode. gedit GUI Text Editor tail Look at the last 10 lines of a file. Ex: tail –f <filename> , Ex: tail -100 <filename> head Look at the first 10 lines of a file. (head <filename>) International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  14. File compression, backing up and restoring compress Compress data. uncompress Expand data. gzip - zip a file to a gz file. gunzip - unzip a gz file. tar Archives files and directories. Can store files and directories on tapes. Ex: tar -zcvf <destination> <files/directories> - Archive copy groups of files. tar –zxvf <compressed file> to uncompress zip – Compresses a file to a .zip file. unzip – Uncompresses a file with .zip extension International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  15. cat View a file Ex: cat filename cmp Compare two files. cut Remove sections from each line of files. diff Show the differences between files. Ex: diff file1 file2 : Find differences between file1 & file2. echo Display a line of text. International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  16. reboot – reboot the system Usage: reboot [OPTION] eg. reboot poweroff – power off the system Usage: poweroff [OPTION] eg. poweroff International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  17. vi,Edit a file. vi is one of the most powerful text editors :x<Return>quit vi, writing out modified file to file named in original invocation :wq<Return>quit vi, writing out modified file to file named in original invocation :q<Return>quit (or exit) vi :q!<Return>quit vi even though latestchanges have not been saved for this vi call International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  18. Cursor Movement h move left (backspace) j move down k move up l move right (spacebar) [return] move to the beginning of the next line $ last column on the current line 0 move cursor to the first column on the current line ^ move cursor to first nonblank column on the current line w move to the beginning of the next word or punctuation mark W move past the next space b move to the beginning of the previous word or punctuation mark B move to the beginning of the previous word, ignores punctuation e end of next word or punctuation mark E end of next word, ignoring punctuation H move cursor to the top of the screen M move cursor to the middle of the screen L move cursor to the bottom of the screen International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  19. Sources to learn commands Primary – man(manual) pages. man <command> Shows all information about the command <command> help Shows the available options for that command Secondary – Books and Internet International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

  20. Thank You International Training Course on “Climate Analysis and Applications”10-19 October 2011WMO RTC-Turkey Facilities Alanya, Antalya, TURKEY

More Related