Unix Flashcards
command for: list contents of current directory
ls
command for: make a directory
mkdir
command for move:
mv
command for rename:
mv
what would the command be to move text1 into directory files
mv text1 files
command for changing to a directory:
cd
command for printing current directory to the terminal:
pwd
command to move to previous directory:
cd ..
command to show contents of a file:
more
command to copy:
cp
command to remove:
rm
command to remove a directory:
rmdir
command to change security permissions:
chmod
command to do a long list of files:
ls -l
addition to ls if we want to see details of files and direcetories:
ls -l
wildcard to match anything (to be read by shell):
*
in file permissions what are u,g,o?
u = user
g = groups
o = the rest
how would you see what permission groups you’re in?
groups
in file permissions, what are r,w,x?
r = read
w = write
x = execute
what symbol can be used for home directory?
~
how can the home directory symbol be used to mean someone else’s home directory?
~theiruserid
what does man -k do?
search manual for a following word
what is the command to find someones username?
finger
what is the quick way to write current directory in a pathname?
.
what is the command for printing two files together?
cat
what does > do?
replaces the following file with the content before the symbol
what does ‘»’ do?
appends the content before the symbol to the file that follows
command to copy a directory?
cp -r
command to see how much disk space is free?
df
command to remove a directory and everything in it?
rm -r
command to list all processes?
ps aux
meaning of |?
‘pipes’ the result of a previous command into another
command to end a process?
kill
what does -9 do to the kill command?
tells the process to die immediately and not ‘tidy up’
how do you exit a more command?
q
what does it mean for a file to begin with a .
hidden file
what does -r do to ls?
lists things recursively from a directory
how would you create an empty text file from the terminal?
touch
what does the command du do?
it shows the disk usage for the current directory and its subdirectories.
how does -s change the result of du?
summary - shows disk usage of current directory without splitting it up for each subdirectory
how does -s* affect the result of du?
shows summarised disk usage information for each subdirectory of the directory
what does -alg do to ls?
a = show all
l = long listing
g = omit owner column
what does grep do?
search for a particular string or pattern in a file
what needs to be used with grep if we want to search for a string of several words?
” “ quote marks otherwise the shell tries to interpret the space
how would you redirect the errors of a command somewhere?
command > (where you want normal results) > (where you want errors)
what would grep interpret “st.” as?
st followed by any single character
whta does \ do inside quotes for grep?
the next character is read literally rather than as a regular expression
how do you get a \ to be read literally?
with another backslash \
what’s the difference between ls -r and ls -R ?
ls -r lists recursively from the bottom up whereas ls -R lists more typically from top down