Hardware Reference
In-Depth Information
head and tail
Another handy set of commands that you can use to see the contents of a file are
head
and
tail
. The
head
and
tail
commands go together and show the start of
the end of a file. The
head
command is extremely useful if you want to see whether
a big file is the file that you are looking for and it is too big to be shown using
cat
.
The
tail
command is extremely handy if you want to look at the last few entries
in a log file.
The head and tail commands
The
head
and
tail
commands have many different options that you can use in order
to customize the output format of the file on the screen. The most important is the
-n
option. The
-n
option followed by a number will display
n
lines of the file. You can
find the other options by running
man head
or
man tail
.
cp
cp
is another important command in bash.
cp
copies a file or folder from one folder
to another. By default,
cp
will overwrite a file in the destination folder if it already
exists, so beware!
To use
cp
, you first need to specify the file or folder that you want to copy followed
by the destination folder. If you select a directory, it will copy just this directory. If
you want to make an exact copy of the directory, you need to use the
-r
command.
The
-r
command recursively copies the folder.