Chapter 3 Flashcards
touch
command to create new empty files
touch fileName1 fileName2 fileName3
primary purpose of touch is to change the file’s time stamp and date stamp
rm
(remove) command to delete files or directories
rm fileName* to remove all files starting with fileName
rm -i
display a warning prompt before deleting a file or directory
rm -r
when deleting a directory, recursively deletes its files and subdirectories
mkdir
make directory command
mkdir directoryName
mkdir -v
display a verification message after directory creation
mkdir -p
mkdir –p (parent) option can be used to create parent directories while creating lower level directories.
* You can create multiple levels of directories including all the directories in a pathname simultaneously.
* For example, mkdir –p grandparent/parent/child
rmdir
remove an empty directory
cp
copy command to copy a file
requires two arguments
1. source file or directory (multiples are ok)
2. target file or directory
cp /the/copyFile /destination/toCopy
if toCopy is a subdirectory then copyFile will be saved in that subdirectory. If toCopy is not a subdirectory copyFile will be saved under the name toCopy.
cp -b
makes a backup of the destination file if the copy will overwrite a file
cp -i
provides a warning when you are about to overwrite a file
cp -u
specifies to only overwrite if the file you are copying is newer than the one you are overwriting
cp -r
recursive: referring to itself and its own contents. recursive search includes all subdirectories in a directory and their contents
cat
concatenate
display the contents of one or more text files on the terminal
tac
tac is cat spelled backwards. displays contents of files in reverse order
head
displays the first ten lines of a file
tail
displays the last ten lines of a file
more
displays text files page-by-page
spacebar key goes to next page
enter key goes to next line
b to go backward
f to go forward
less
same as more but allows you to use arrow keys to scroll up and down the contents of file
b to go backward
f to go forward
gn goes to n line
q to quit
strings command
searches for and displays text characters in a binary file.
strings /location/file
cat -n
display the line number of each line in the file in addition to the contents