Database Reference
In-Depth Information
$ rm old-file
In case you want to remove an entire directory with all its contents, specify the -r
option, which stands for recursive:
$ rm -r ~/book/ch02/data/old
In case you want to copy a file, use cp (Granlund, MacKenzie, & Meyering, 2012).
This is useful for creating backups:
$ cp server.log server.log.bak
You can create directories using mkdir (MacKenzie, 2012):
$ cd data
$ mkdir logs
All of these command-line tools accept the -v option, which stands for verbose , so
that they output what's going on. All but mkdir accept the -i option, which stands for
interactive , and causes the tools to ask you for confirmation.
Using the command-line tools to manage your files can be scary at first, because you
have no graphical overview of the filesystem to provide immediate feedback.
Help!
As you are finding your way around the command line, it may happen that you need
help. Even the most-seasoned Linux users need help at some point. It's impossible to
remember all the different command-line tools and their options. Fortunately, the
command line offers severals ways to get help.
Perhaps the most important command to get help is perhaps man (Eaton & Watson,
2014), which is short for manual . It contains information for most command-line
tools. Imagine that we forgot the different options to the tool cat . You can access its
man page using:
$ man cat | head -n 20
CAT(1) User Commands CAT(1)
NAME
cat - concatenate files and print on the standard output
SYNOPSIS
cat [OPTION]... [FILE]...
DESCRIPTION
Concatenate FILE(s), or standard input, to standard output.
-A, --show-all
equivalent to -vET
Search WWH ::




Custom Search