Directories, files and Redirection Flashcards
What is an alias?
Alias gives a command an alias name to use, only around during your current shell however you can save it in the startup file, however other currently running shells will have to be restarted to get that configuration
What is one limitation for a alias?
cannot put any variable information into the alias
What are the values in “drwr-xr 2 jacob jacob 4096 Jan 10 16:40 bin” for
–first set of values indicates the file type d is a folder, and - is a normal file.
–After the D or - the r, rw, x, indicates permissions.
R - read,
RW - read and write,
x - execute
–number is a link count
–Next information is the owner, then group
–number is the size of the file or folder
–date and time of last modification
–Last is the name of the file or folder
What option would you use with ls command to show you hidden files/folders
-a, those files start with a .
What option would you use with ls to show the file size in bytes?
-li
What does the mkdir command do?
makes a directory
What does the cd command do?
changes the directory, followed by the directory name
What does the touch command do?
creates and empty file
What does the rm command do?
removes a file
What does the cd.. command do?
takes you back one level
What does the rmdir command do?
removes a directory
What does the pwd command do?
print working directory
What does the cd - command do?
takes you back to where you last were
What does the cd command do with no other input?
takes you home, cd~ also takes you home
What does the cd~/bin command do?
takes you to the home and then to the bin directory, replace bin for any other directory
What does the cat command do?
shows you the content of the string
What does the cp command do? What would the structure look like?
copies a file. Two ways of using this command.
- Moving a file to a new folder cp file /tmp, where /tmp is the new location and file is the name of the file you are moving
- Renaming a file, cp file file2, where file is the file to be copied and file2 is the new name
What does the mv command do? What would the structure look like?
mv moves files, renames files,
- moving a file, mv file /tmp
- moving and renaming, mv file /tmp/new-name
Absolute Path
Always starts with the root, example cd /etc/init.d as opposed to the relative path cd ../../etc/init.d
Realative Path
../../etc.init.d as opposed to the absolute path /etc/init.d