Ubuntu Unleashed 2019 Edition: Covering 18.04, 18.10, 19.04

(singke) #1

Click here to view code image
matthew@seymour:~$ ls stuff/article.txt
article.txt
matthew@seymour:~$ nano !*


Viewing Your History and More


By default, the previous 1,000 commands you have run are saved in your
/home directory in a file called .bash_history. You can edit this file.
You can delete this file. You can change the number of commands saved in
your history by editing this line in the .bashrc file in your /home directory
to whatever number you want:


HISTSIZE=1000

Doing Two or More Things


There are a few ways you can do two or more things on one line.


Separating commands with a ; (semicolon) causes the second command to
execute after the first command is complete, regardless of the result of the
first command. Here is an example:


Click here to view code image
matthew@seymour:~$ command1 ; command2


If you want the second command to be run only if the first command exited
with no errors, use && (two ampersands):


Click here to view code image
matthew@seymour:~$ command1 && command2


If you want the second command to be run only if the first command fails, use
|| (two pipes):


Click here to view code image
matthew@seymour:~$ command1 || command2


Using Shortcuts


We all make typing errors while entering commands. When you notice an
error in a long line of text, just before you press Enter, it is frustrating to use
the Backspace key to erase the entire line one character at a time. There are
faster ways.

Free download pdf