Within a directory, what must each name be?
Within a directory, each name (file or directory) must be unique (UNIX is case sensitive tho)
UNIX root node
/
1/42
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Within a directory, what must each name be?
Within a directory, each name (file or directory) must be unique (UNIX is case sensitive tho)
UNIX root node
/
what does . refer to in any directory?
itself
what does . . refer to in any directory?
the parent directory
pwd
present working directory, returns what directory you are in
cd
change directory. with no arg, goes to home directory, else, goes to arg
mkdir
make new directory (mkdir newdirectory)
mv
move (renames file or directory) (mv oldname newname) (also move files (mv filename directoryname))
ls (ls -l) (ls -a)
lists contents of directory (lists w detail) (lists even hidden ones)
date
prints current date and time
touch
Reset the modification date and time of a file to now (if file does not exist, creates new one) (touch filename)
cp, cp -r
Copy a file: cp filename copyoffile. copy a directory: cp -r dirname copydir
rm
Remove. Delete a file: rm filename
rmdir
Remove empty directory. Delete a directory (which needs to be empty): rmdir dirname
cat
Concatenate. Print out the contents of a file: cat filename
head
Print out the first lines of a file: head filename
tail
Print out the last lines of a file: tail filename
more
Print out the contents of file one screen at a time: more filename
less
Print out the contents of file one screen at a time: less filename. Like more, but allows backward movement.
man
Manual. Displays the online manual page for the given argument
cd ~, cd .., cd -
home directory, parent directory, last directory you were in
cp -r
cp -r directoryname copyname (makes a copy of a directory )
rm -i
asks for permission before removing
rmdir -r
removes any directory even if not empty
tail/head -n 5 filename
prints out first five lines of filename
echo –args–
just prints whatever args is
–args– > filename
puts the stdout of args into filename (rewrites filename)
–args– » filename
adds to filename on newline
wc filename
returns the number of lines words and characters in filename
wc (no args)
you type what you want, press CNTRL + D, returns number of lines words and characters you wrote
<
pipes in stdin or whatever
arg1 | arg2
pipes stdout of arg1 into stdin of arg 2
wc < filename
returns word count of filename
?
when used in a filename, stands for any character
*
stands for any length string of characters
- -
doesn’t eval next thing
diff file1 file2
displays the differences between file1 and file2. > is things in file2. < is things in file1
grep string file
search for “string“ in file
ls | grep html, cat file1 file2 | grep ‘hello world‘
use grep to find all html files, use it to find all instances of ‘hello world‘ in file1 file2
file file1
determines type of file1
whoami
print out username
id
it prints out the id numbers related to your username and group, and then it prints out all groups that you are in. ex:
uid=25324708(ehs72) gid=25324708(ehs72) groups=25324708(ehs72),20166(202501_cpsc.201.01-student)