User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

wiki:startbash [2017/12/05 22:53] (current)
Line 1: Line 1:
 +====== Introduction to Bash ======
 +The object of this document is the use of Bash language to explore and manipulate files rather than to set/​interact with the operation system.\\
 +You can read and follow the text.  At the same time you can copy the commands included in the frames part of this document and paste them into an interactive Bash shell.\\
 +Once you have familiarity with the general commands of Bash you can further advance in learning bash with online manuals and guides. There is a large variety of documentation available at: 
 +   * http://​​lessons/​advanced/​x1110.html ​
 +   * http://​​LDP/​abs/​html/​
 +A very useful summary of the most important commands can be found on [[http://​​ost4sem/​reference/​UnixLinux_command_reference_card.pdf | ~/​ost4sem/​reference/​UnixLinux_command_reference_card.pdf ​ ]]. It is recommended to print and use it during the course.
 +The best way is just to try each command using a file, and/or search on the Internet for more examples and deeper explanations.
 +===== Searching for a command, getting help, running a command, saving a result =====
 +==== Searching for a command, getting help ====
 +In a Shell window (the terminal) the following prompt is written:
 +   ​user@pc_name:​directrory$
 +after the $ you are able to insert the command\\
 +Command syntax:
 +   ​command [option] [file]
 +The symbol [] identifies an optional feature of the command. It can be inserted to retrieve more information or different setting of a command.\\
 +To get a command for a specific action type "​apropos the_word_that_you_need"​.\\
 +e.g. I want to search for a command able to count the line in a file
 +<code bash>
 +   man -k count
 +in the last lines you get:\\
 +"wc (1)               - print newline, word, and byte counts for each file"​\\
 +so the command "​wc"​ is your command\\
 +To get information about a command type "man command"​ or info "​command"​ e.g.
 +<code bash>
 +   man wc
 +<code bash>
 +   info wc
 +To exit from the help press "​q"​
 +==== Running a command, saving a result ====
 +The symbols > are used to save the result of a command in a file.\\
 +Instead < is used to retrieve information from a file.\\
 +In this case, using the informatics terminology we can use the expression "​standard input and output redirection"​.\\
 +This page summarize the [[http://​​asch/​f/​MeCS/​courseware/​users/​help/​general/​unix/​redirection.html|Standard Input and Output Redirection]] common used.\\
 +In this course we will mainly use the symbol >  > >  <. e.g.\\
 +<code bash>
 +   ls > mylist.txt
 +it will save the file names that you have under the directory in a file called mylist.txt
 +<code bash>
 +   ls >> mylist.txt
 +It will append again the file names to the same file without deleting the previous content of the file.\\
 +See the result by typing:
 +<code bash>
 +   more mylist.txt
wiki/startbash.txt ยท Last modified: 2017/12/05 22:53 (external edit)