starts with a slash (/), which represents the root directory. The slash is followed by the name of a file located in the root directory. An absolute pathname can continue, tracing a path through all intermediate directories, to the file identified by the pathname. String all the filenames in the path together, following each directory with a slash (/). This string of filenames is called an absolute pathname because it locates a file absolutely by tracing a path from the root directory to the file.
New cards
2
Relative Pathname
traces a path from the working directory to a file. The pathname is relative to the working directory. Any pathname that does not begin with the root directory (represented by /) or a tilde (\~) is a relative pathname
New cards
3
3 ways to return to your home directory
cd \~, cd, cd $HOME
New cards
4
What‘s the arrangement of directories and files in the unix system?
a tree-like structure called the file system, called a directory tree. At the very top of the file system is a directory called “root” which is represented by a “/”. All other files are “descendants” of root.
New cards
5
What directory does it take you to when you first log in?
The home directory.
New cards
6
What’s the command that gives helpful information on a utility?
man (eg: ‘man cat’ will display a manual on the cat utility)
New cards
7
What symbol do hidden files in a directory start with?
dot character (.)
New cards
8
What’s the command that tells you the current name of the shell?
echo $0 (returns -bash)
New cards
9
Set a variable value in a borne shell. How do you display the variable?
echo $variname
New cards
10
What does echo $PATH display?
Which directories your shell is set to check for executable files. $PATH is the list of said directories.
New cards
11
What is the command and option that lets you see all the meta information of a file?
ls -l filename
New cards
12
Inside a borne shell script, what’s the symbol used for the PID?
$$
New cards
13
What’s the command that can be used to change permission information for a file?
chmod
syntax: chmod a+r filename (makes filename readable to all)
New cards
14
What’s the command that copies files?
cp
syntax: cp ogfile copyfile
New cards
15
What’s the command that is used to tell the type information of a file?
file
eg: file filename (displays filename: ASCII text)
New cards
16
What’s the command used on a file to display one page of information of the file contents at a time?
more or less (less allows you to scroll up, more does not)
eg: cat filename | less
New cards
17
What’s the command to make soft links?
ln -s filename linkname
Allows multiple filenames to be linked to a file
New cards
18
What’s the command that outputs the contents of a text file?
cat filename
New cards
19
What’s the command that searches for patterns in a text file?
grep string filename
New cards
20
Basic redirection syntax.
cat > filename
Create a file called filename. Type the desired input and press CTRL+D to finish. The text will be in file filename.
cat < filename
Just cats the content of filename.
New cards
21
What is the command that makes a new subdirectory/directory?
Mkdir dirName
New cards
22
What’s the command that removes a file? Moves a file?
rm filename
mv filename newfile
New cards
23
What’s the command that displays the information about the users logged into the system?
who
New cards
24
What’s the command that deletes a non-empty directory?
rmdir or rm -d
New cards
25
If I touch a file name, and the file name doesn't already exist, does touch create it?
Yes, touch creates an empty file.
New cards
26
If you set the variable value in the shell and you want a program/script to read and display it, what command do you have to do on the variable to make it available to the script?
export
New cards
27
How do you read in a value in a shell prompt?
read
New cards
28
What does the command “find” do? find -name?
used to find files and directories and perform subsequent operations on them. It supports searching by file, folder, name, creation date, modification date, owner and permissions.
\ find -name searches filenames specifically.
New cards
29
What is the command to list all the files in your working directory that start with a dot?
ls -a lists all files including hidden files that start with a dot. do not try ls .\* it broke my thing
New cards
30
Metacharacter for pipe?
|
New cards
31
Which key stroke will enter command mode in VIM?
esc
New cards
32
in VIM, which keystroke will allow you to enter editor mode?
i
New cards
33
What mode is VIM in at first?
command mode
New cards
34
Command to write (save) the contents of the files then quit the editor?
esc :wq!
New cards
35
What symbols do commands start with in VIM?
\:
New cards
36
Can you chmod a file you don’t own?
No
New cards
37
Can you list metadata on files you don’t own?
Yes
New cards
38
What is a root?
A user that can do anything (ex: chmod any file)
New cards
39
What does touching an already existing file do? Does it reset it’s permissions?
if the file existed beforehand, touch will not change its permissions, just update its last edited timestamps
New cards
40
What is a token?
A non blank character/sequences of characters
\ A token is made up of ordinary characters, or of operator characters ()<>&|;, but not both. For example, foo
New cards
41
What symbol do options start with?
\-
New cards
42
Identify commands with 0 arguments.
cd, pwd
New cards
43
What is an example of a built-in command?
echo, cd
New cards
44
How do you do piping?
A pipe is a form of redirection (transfer of standard output to some other destination). Allows you to use 2 commands at once
ex: history | tail
calls history command and tail to display the last 10 executed commands
New cards
45
What’s the comments you need on the first line of the script to ensure it gets executed on the bash shell?
\#!/bin/bash
New cards
46
What are the 2 metasymbols you have to put at the beginning of a script for it to run correctly?
./
New cards
47
What’s the syntax for creating an alias?
alias ‘someAlias=someCommand’
New cards
48
What does grep do? Syntax?
Identifies line with requested string.
grep “l” filename
works on directories to search file names
New cards
49
Which file do you save variables, functions, and aliases to so they are available upon log in?
In the \~/.bashrc file
New cards
50
What are the single dot and double dot directory entries?
mkdir automatically adds these 2 entries.
The . is synonymous with the pathname of the-working directory and can be used in its place; the .. is synonymous with the pathname of the parent of the working directory. These entries are hidden because their filenames begin with a period.
New cards
51
num=875
number1=”Add $num”
number2=’Add $num’
\ What will echo $number1 and echo $number2 display?
Add 875
Add $num
New cards
52
ls -l info idk just memorize this
New cards
53
chmod symbols (just memorize this too)
New cards
54
Do I have to put symbols in front of a function name to run it or can I just put the name of the function?
Just name of function.
New cards
55
What is the shell metacharacter that matches 0 or more characters?
\*
New cards
56
What is the shell metacharacter that matches 1 character?
?
New cards
57
Inside a script, what are the symbols that contain the arguments on the command line to the script?
$1, $2, … , $n for each argument n on the command line