Example: biology

Linux Fundamentals by Commands and Examples

Linux Fundamentals by Commands and Examples version Editor: Ahmed Baraka Document Purpose This document is edited to be a quick reference of Linux essential Commands . It can be used by Linux beginners as a reminder of basic Linux Commands usage. It cannot be used to learn Linux from scratch. The document is oriented based on the required task, the command (s) to do the task, basic syntax of the command , and Examples . No explanation will be presented. Usage Terms Anyone is authorized to copy this document to any means of storage and present it in any format to any individual or organization for non-commercial purpose free.

Linux Essentials article by Thomas Girke. The Linux Cookbook: Tips and Techniques for Everyday Use by Michael Stutz . Red Hat Linux Getting Started Guide, 2003

Tags:

  Linux, Example, Fundamentals, Command, Linux fundamentals by commands and examples

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Linux Fundamentals by Commands and Examples

1 Linux Fundamentals by Commands and Examples version Editor: Ahmed Baraka Document Purpose This document is edited to be a quick reference of Linux essential Commands . It can be used by Linux beginners as a reminder of basic Linux Commands usage. It cannot be used to learn Linux from scratch. The document is oriented based on the required task, the command (s) to do the task, basic syntax of the command , and Examples . No explanation will be presented. Usage Terms Anyone is authorized to copy this document to any means of storage and present it in any format to any individual or organization for non-commercial purpose free.

2 No individual or organization may use this document for commercial purpose without a written permission from the editor. There is no warranty of any type for the code or information presented in this document. The editor is not responsible for any loses or damage resulted from using the information or executing the code in this document. If any one wishes to correct a statement or a typing error or add a new piece of information, please send the request to . If the modification is acceptable, it will be added to the document, the version of the document will be incremented and the modifier name will be listed in the version history list.

3 Page 1 Linux Fundamentals by Commands and Examples Version History Version Date Updates 25-June-2009 Initial document. Resources Resource Name Linux Essentials article by Thomas Girke. The Linux Cookbook: Tips and Techniques for Everyday Use by Michael Stutz Red Hat Linux Getting Started Guide, 2003 Red Hat Essentials RH033 (courseware material) Linux Reviews website The Linux Tutorial website Zytrax Info website Academic Computing And Communications Center ACCC website The Linux Information Project website UNIX & Linux Shell Scripting Tutorial website Page 2 Linux Fundamentals by Commands and Examples Contents Introduction _____ 7 Unix variants _____7 GNU/ Linux distributions _____7 Getting Started _____ 8 Virtual Consoles _____8 Changing password _____8 Logging-In_____8 Date and Time Commands _____8 Making Arithmetic Calculations _____8 Generating Sequential Numbers _____8

4 Getting Help _____9 Handy shortcuts _____9 Managing Files and Directories_____ 10 Files and Directories Commands _____10 Determining File Content_____11 Viewing Files _____11 Hard and Symbolic (Soft) Links_____12 Checking Free Space _____12 Searching Files By Names _____12 Searching Files By Names and Attributes _____12 Archiving Files _____14 Compression Utilities _____14 Text File Processing Tools _____14 Users, Groups and Permissions _____ 15 Change Password _____15 Change Your Identity _____15 User Information Commands _____15 Changing File Ownership_____15 Changing Permissions _____15 Default File Permission _____15 Special Permission _____16 Page 3 Linux Fundamentals by Commands and Examples bash Shell Basics _____ 17 File Blobbing _____17 History Tricks _____17 command Line Expansion _____17 Local Shell Variables _____18 Aliases_____19 Type _____19 Environment Variables _____19 Showing Path of Executable _____19 Login and

5 Non-Login Shells _____20 Startup and Logout Scripts _____20 Recording a Shell Session _____20 Standard I/O and Pipes _____ 21 Redirecting Output to a File _____21 Redirecting STDOUT to a Program (Piping)_____21 Redirecting to Multiple Targets _____21 Redirecting STDIN from a File _____21 Sending Multiple Lines to STDIN _____21 Text Files and String Manipulation _____ 22 Viewing File Contents _____22 Viewing File Excerpts _____22 Extracting Text by Column _____22 Gathering Text Statistics _____22 Sorting Text_____23 Eliminating Duplicates_____23 Comparing Files_____23 Spell Checking with aspell_____23 Converting Characters_____24 Combining Files _____24 Expanding Tabs Into Spaces _____24 Regular Expressions _____24 Extended Regular

6 Expressions _____25 Extracting Text by Keyword _____25 Search and Replace _____26 Page 4 Linux Fundamentals by Commands and Examples Editing Text by Programming Language _____26 Using the Text Editor vi _____ 27 Modes _____27 Search and Replace ( command Mode) _____27 Manipulating Text ( command Mode)_____27 Undoing Changes ( command Mode) _____28 Visual Mode _____28 Using Multiple "windows" _____28 Configuring vi and vim _____28 Managing Processes _____ 29 Listing Processes_____29 Sending Signals to Processes _____31 Changing Process Scheduling Priority _____31 Listing Background and Suspended Jobs_____31 Resuming Suspended Jobs _____31 Compound Commands _____32 Scheduling a Process_____32 Scheduling a Process Periodically _____32 bash Shell Scripting Basics _____ 33 Creating Shell Scripts _____33 Handling Input _____33 Shell Script Debugging _____33 Handling

7 Positional Parameters (Arguments) _____33 Using Functions _____34 Exit Status _____34 Conditional Execution _____34 Using the if Statement_____34 Using the Case Statement _____35 Using the For Loop _____35 Using the While loop _____35 Disrupting Loops _____36 File Tests _____36 String Tests _____37 Page 5 Linux Fundamentals by Commands and Examples Shell Option Test _____37 Logical Tests _____37 Comparison _____37 Page 6 Linux Fundamentals by Commands and Examples Introduction Unix variants Unix, GNU/ Linux , Solaris, IRIX, HP-UX, FreeBSD, OpenBSD, NetBSD, Darwin (Mac)

8 , and GNU/ Linux distributions Ubuntu, Edubuntu, Debian, RedHat, Fedora, Slackware, SuSE, Darwin, and Family tree of the GNU/ Linux distributions Page 7 Linux Fundamentals by Commands and Examples Getting Started Virtual Consoles In Red Hat: available through CTRL+ALT+F[1-6] If X is running, it is available as CTRL+ALT+F7 Changing password passwd Logging-In From Mac or Linux ssh -X your_username@hostname From Windows: Open Putty and select ssh. Use WinSCP software for file exchange. Date and Time Commands date u display date and time in UTC R display date and time in RFC822 (used in email messages) chrony package maintains time by connecting to servers over the Internet.

9 Cal output a calendar for the current month y print calendar of current year cal 2010 #output a calendar for the year 2010 Making Arithmetic Calculations bc supported operators: + - * / % ^ sqrt() Generating Sequential Numbers seq w make all generated numbers of same width s 'b' make b character as the separator between numbers seq 7 seq -5 5 Page 8 Linux Fundamentals by Commands and Examples seq 1 2 10 # from 1 to 10 increment by 2 seq s ' ' 1 23 # separated by spaces Getting Help man info apropos search for only exact matches whatis to list a one line description of a program Software packages may store its help files in /usr/share/doc Online help.

10 SuperMan Pages, Linux Documentation Project (LDP) man ls man k copy # search for "copy" in the whatis database apropos copy # search for "copy" (not "xcopy") in the whatis database man f copy # restrict search for the whole word ls -- help # brief help usage info cp # information is organized into sections whatis who Handy shortcuts # up(down)_key scrolls through command history # <something-incomplete> TAB completes path/file_name # Ctrl+a # cursor to beginning of command line # Ctrl+e # cursor to end of command line # Ctrl+d # delete character under cursor # Ctrl+k # cut line from cursor into kill buffer # Ctrl+y # paste content from Ctrl k Page 9 Linux Fundamentals by Commands and Examples Managing Files and Directories Files and


Related search queries