Podcast
Questions and Answers
What command line puts the date in a file in your HOME directory?
What command line puts the date in a file in your HOME directory?
If my current working directory is /home, and my HOME directory is /home/me, which command copies the password file into my HOME directory under the name foo?
If my current working directory is /home, and my HOME directory is /home/me, which command copies the password file into my HOME directory under the name foo?
If foo is a sub-directory that contains only the file bar, what happens after this command: mv foo/./bar foo/././me?
If foo is a sub-directory that contains only the file bar, what happens after this command: mv foo/./bar foo/././me?
In the output of the command ls -a, the one-character name . signifies what?
In the output of the command ls -a, the one-character name . signifies what?
Signup and view all the answers
What is the result of this exact command line: ls /foo bar?
What is the result of this exact command line: ls /foo bar?
Signup and view all the answers
What can you do to get back (redo) the last command you typed?
What can you do to get back (redo) the last command you typed?
Signup and view all the answers
Which command line does not show any lines from inside the file bat?
Which command line does not show any lines from inside the file bat?
Signup and view all the answers
If my current directory is /etc, which of these pathnames is equivalent to the file name /etc/passwd?
If my current directory is /etc, which of these pathnames is equivalent to the file name /etc/passwd?
Signup and view all the answers
What does quoting mean on a shell command line?
What does quoting mean on a shell command line?
Signup and view all the answers
How many arguments does the shell pass to this echo command: echo one two three >four five?
How many arguments does the shell pass to this echo command: echo one two three >four five?
Signup and view all the answers
Which of the following pathnames almost always leads to the same file named: /bin/ls
Which of the following pathnames almost always leads to the same file named: /bin/ls
Signup and view all the answers
In which section of the manual do you find super-user and admin commands?
In which section of the manual do you find super-user and admin commands?
Signup and view all the answers
What is the correct interpretation of the command: wc -wc wc
What is the correct interpretation of the command: wc -wc wc
Signup and view all the answers
What Linux command displays the contents of a file?
What Linux command displays the contents of a file?
Signup and view all the answers
What is true after the command line: touch new ; mv ./mt/../new ../me/old
What is true after the command line: touch new ; mv ./mt/../new ../me/old
Signup and view all the answers
What is an operating system?
What is an operating system?
Signup and view all the answers
Which pathname almost always leads to the same file named: /etc/shadow
Which pathname almost always leads to the same file named: /etc/shadow
Signup and view all the answers
What option to ls shows inode (index) numbers?
What option to ls shows inode (index) numbers?
Signup and view all the answers
If my current working directory is /var, which command copies the password file into directory /var/ian under the name bar?
If my current working directory is /var, which command copies the password file into directory /var/ian under the name bar?
Signup and view all the answers
In which section of the manual do you find standard commands?
In which section of the manual do you find standard commands?
Signup and view all the answers
If my current directory is /etc, which of these pathnames is equivalent to the pathname /etc/x/y?
If my current directory is /etc, which of these pathnames is equivalent to the pathname /etc/x/y?
Signup and view all the answers
What is the correct syntax to redirect both standard output and standard error into the same output file?
What is the correct syntax to redirect both standard output and standard error into the same output file?
Signup and view all the answers
What command can you use to delete an empty directory?
What command can you use to delete an empty directory?
Signup and view all the answers
What is the simplified pathname for /../../var/./a/../../var/b/../../etc/./bar/../foo?
What is the simplified pathname for /../../var/./a/../../var/b/../../etc/./bar/../foo?
Signup and view all the answers
The option to ls that shows which names are directories is:
The option to ls that shows which names are directories is:
Signup and view all the answers
How do I search for the string foo in the text display output from the man command?
How do I search for the string foo in the text display output from the man command?
Signup and view all the answers
Which pathname almost always leads to the same file named /etc/passwd?
Which pathname almost always leads to the same file named /etc/passwd?
Signup and view all the answers
What Linux command copies an entire directory?
What Linux command copies an entire directory?
Signup and view all the answers
What happens after this command: mv ./foo/bar foo/../me?
What happens after this command: mv ./foo/bar foo/../me?
Signup and view all the answers
Study Notes
###UNIX Commands and Pathnames
- The section of the manual to find standard commands is 1.
- The pathname
/etc/x/y
is equivalent to./etc/x/y
when the current directory is/etc
. - To redirect both standard output and standard error into the same output file, use the syntax
date 2>&1 >out
. - The command to delete an empty directory is
rmdir
. - The pathname
/../../var/./a/../../var/b/../../etc/./bar/../foo
simplifies to./etc/foo
. - The option to
ls
that shows which names are directories is-l
. - To search for the string "foo" in the text display output from the
man
command, use./foo
. - The pathname
/etc/./etc/../passwd
almost always leads to the same file named/etc/passwd
. - The Linux command that copies an entire directory is
cp -r d1 d2
. - The pathname
/usr/./bin/../lib/../../etc/../usr/./lib/../bin/..
simplifies to./usr/lib
. - If
foo
is a sub-directory that contains only the filebar
, the commandmv ./foo/bar foo/../me
will leave the directoryfoo
empty. - To copy the password file into the HOME directory under the name
foo
, usecp ../../etc/passwd ../../../home/me/foo
. - The pathname
./etc/../passwd
almost always leads to the same file named/etc/passwd
.
###More Pathnames and Commands
- If the current working directory is
/home
, the commandcp ../../etc/passwd ../../../home/me/foo
copies the password file into the HOME directory. - The command
ls /foo bar
displays the names of the pathnames/foo
andbar
. - To redo the last command typed, use the "UpArrow" key.
- The command
ls bat
does not show any lines from inside the filebat
. - If the current directory is
/etc
, the pathname../passwd
is equivalent to the file name/etc/passwd
.
###Quoting, Searching, and More Commands
- Quoting on a shell command line means turning off the special meaning of shell meta-characters.
- To search for the word "nongraphic" in the man page for
ls
, typeman ls
at the shell, then/nongraphic
. - The bash shell expands a leading tilde (
~
) in a pathname to be the HOME directory. - To make the bash shell complete commands or file names, type the first part of the command or file name and then press
[TAB]
. - The command
cd /home/dir ; mkdir one ; mkdir two ; pwd
outputs/home/dir
.
###More Commands, Pathnames, and File Manipulation
- The option to
ls
that shows hidden names is-a
. - The command
echo one two three >four five
passes 4 arguments to theecho
command. - The command
mv ./ian/./foo ./ian/../bar
will leave the directoryian
empty. - The operating system is a computer program that manages the hardware.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Description
Test your knowledge of Unix commands and pathnames with these questions. Learn how to navigate and use standard commands in Unix.