Command Line Flashcards
. command
current directory
.. command
previous directory
What is “" used for?
To escape a character
ls command
list the current filesystem
mv command
move a file
cp command
copy a file
what’s the difference between starting a filesystem with or without a “/”?
a starting / means it is an absolute path; not starting with one means a relative path
rm command
remove something
*
wildcard operator that matches any number of characters
-r
recursive option
find command
search for things
man command
brings up the manual
su command
substitute user: su <username> <password></password></username>
normal user privileges
can modify own stuff. can’t modify system stuff
root user privileges
You can modify anything. It is usually disabled
sudo command
briefly take command as a root user
why do file permissions have 9 slots?
3 groups of 3 permissions each. The groups are the current user, the group, and others. the type of permissions are read, write, and execute.
file permissions execute?
you can run the file as program
chmod command
changes the permission mode string
chown command
change the files owner
chgrp command
change the file’s group
how does octal file permission work?
each permission has a number: read: 4, write: 2, execute: 1. You add them all together ie if you have all permissions for user, you get 7. if you only have 5, you get read and execute. you will get a three digit number because you do permissions for user, group, and others all at once.
How does symbolic file permission work?
user, group, and others are represented by u, g, and o. Read, write and execute are represented by r, w, and x. To add a permission, you get the person (u g o) and use the plus symbol. You can subtract a permission with minus. You can set a permission with equals. You can also change all permissions at once with a instead of u, g, or o.
cat command
see the contents of a file
touch command
make a file
stat command
see a lot of information for a file
nano command
lets you edit a file
What is a link?
links are files that reference other files. they are pointers so you don’t need the file in multiple places
What are the two types of links
hard and soft links
ln command
makes a hard link.
ln -s command
makes a soft link
what is the pipe command?
|
echo command
it prints out what you say
What does pipe do?
lets you send your command to something else
head command
see the beginning of a file
tail command
see the end of a file
less command
displays text one page or screenful at a time and provides navigation controls
grep command
searches inside files according to a pattern, can be regex
awk command
extracts specific text from a file
sed command
is a stream editor
rev command
prints text in reverse sequence
tac command
concatenates or displays files in reverse
tr command
translates or modifies individual characters according to parameters
tar command
tape archive to bundle groups of files. Can also apply compression with an option
tar -x command
extract a file