Unix Commands Flashcards
ls -l
List files, long form
pwd
Print working directory
file
Determine file type
date
Print or set the system date and time
date -r
Display the last modification time of a file
touch [file1, file2…]
Updates the access and modification times of each file to the current time. Creates file if it does not exist
chmod
Changes file access permissions
man
Displays the manual page for a command
man -k
Searches the manual for a keyword
cd
Change directory
cd [blank]
Go back to home directory
cd -
Go back to previous directory
mkdir
Make a new directory
mv
Rename or move a file or directory
rm
Delete a file
rm -rf
Delete a directory
rmdir
Delete an empty directory
cp
Copy a file
cp -r
Copy a directory
ls
List files
cat
Concatenates (prints) file to screen
cat -n
Prints file with line numbers
vi
Opens a file in a text editor
>
Redirect output (typically to a file)
&>
Redirect output to a file without showing error messages
>>
Redirect output to append to a file
”
Redirect input
more
Opens text file in page browser with support for scrolling down
less
Opposite of more. Opens text file in page browser with ability to scroll up or down
strings
Finds printable strings in an object or binary file.
wc
Word count. Print the number of lines, words, and characters for a file.
wc -l
Print total number of lines for a file
wc -w
Prints total number of words in a file.
wc -c
Prints total number of characters in a file
head
Prints the first 10 lines of a file
tail
Prints the last 10 lines of a file.
script
Records everything printed on screen and writes it to a file
image
Takes a screen shot (in red hat Linux only)
grep
Regular expression search
egrep
Extended regular expression search
fgrep
Fast regular expression search
ls -a
Shows hidden files
history
Shows saved history in RAM
ln
Creates a hard link
ln -s
Creates a soft link
mount
Attach file system
umount
Detach file system
df
Check usage of mounted file systems