This is an old revision of the document!
Bash for Beginners
This quick-and-dirty tutorial is intended as an introduction to bash for beginners.
Location and time
The tutorial will be held in Room 4 of the PhD Lab on Wednesday 6 November from 9.15 to 10.45.
Requirements
In order to follow the tutorial, you will require a laptop. Depending on your operative system, you will require one of the following:
- Mac. Nothing extra. You are ready to go.
- Linux. Nothing extra. You are ready to go.
Why is bash relevant?
Find yourself at home
You will first learn how to setup a remote connection to the machine
Afterwards, you will understand what is the meaning of “living” in a multi-user setting. You will learn how to list the files and directories, as well as how to move around.
Commands: ssh
, ls
, pwd
, cd
, mkdir
How to display and edit a file
Files can be simply displayed (without performing any modification) or actually opened for edition purposes. You will learn to do both.
Commands: cat
, more
, less
, most
, wc
, nano
Grabbing information in a file from the command line
Until now, the kinds of operation you have performed are quite basic and not to different from what you can do with standard tools. Now we start to do interesting stuff. In this section you will learn how to sort, filter, and modify, and combine the information in a file
Commands: sort
, grep
, sed
, column
Storing the results
All the operations carried out show their result in the terminal, but do not alter the contents nor are stored anywhere. Now we learn how to store them.
Commands: te
, >
, »
Understanding the structure of the commands
We have played with quite a few commands already. Let us understand how commands are usually structured.
Piping to combine commands
Let's start making things interesting: all these commands can be executed one after the other at no extra cost.
Commands: |
One-liners
How to find some help
Commands: man