0% found this document useful (0 votes)
324 views3 pages

UNIX Test PDF

The document contains questions and answers about various UNIX commands. It covers commands for getting help (man, help), navigating directories (cd, ls), copying/renaming files (cp, mv), setting permissions (chmod), searching files (grep), and more. Correct answers are provided for each question to test understanding of UNIX commands and their syntax.

Uploaded by

Gilea Mihai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
324 views3 pages

UNIX Test PDF

The document contains questions and answers about various UNIX commands. It covers commands for getting help (man, help), navigating directories (cd, ls), copying/renaming files (cp, mv), setting permissions (chmod), searching files (grep), and more. Correct answers are provided for each question to test understanding of UNIX commands and their syntax.

Uploaded by

Gilea Mihai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

UNIX test

1 How do you get help about the command "cp"?


a
help cp
b
man cp
c
cp ?
2 Make a copy of file "upper" in the directory two levels up.
a
jump -2 upper
b
cp upper ../..
c
cp upper -2/
3 How do you list all the files that are in the current directory?
a
list all
b
ls -full
c
ls -a
4 Which of the following UNIX commands will not take the user employee5 to his home directory?
a
cd
b
cd ~
c
cd ~employee5
5 How do you rename file "new" in file "old"?
a
mv new old
b
cp new old
c
rn new old
6 What is the generic syntax for all UNIX commands?
a
command name, followed by arguments, followed by options
b
command name followed by arguments
c
command name followed by options
d
command name, followed by options, followed by arguments
7 How do you visualize the content of file "not_empty"?
a
type not_empty
b
cat not_empty
c
more not_empty
8 Change the current directory to /usr/local/bin
a
mv /usr/local/bin
b
cd /usr/local/bin
c
setdir /usr/localbin
9 Which of these commands will set the permissions on file textfile to read and write for the owner,
read for the group, and nothing for everyone else?
a
chmod 755 textfile
b
chmod 640 textfile
c
chmod 644 textfile

10 Create a new file "new.txt" that is a concatenation of "file1.txt" and "file2.txt".


a
cat file1.txt file2.txt > new.txt
b
make new.txt=file1.txt+file2.txt
c
tail file1.txt | head file2.txt > new.txt
11 When you use the ln command, which of the following occurs?
a
a file is created that points to an existing file
b
a file is created that is a copy of an existing file
c
a file is moved from one location to another
d
a file is renamed
12 What UNIX command is used to update the modification time of a file?
a
time
b
modify
c
cat
d
touch
13 Which command will print the contents of all files in the current directory whose names start with
the character "a" and end with a period (".") followed by any two characters followed by a number?
a
ls a*.??[0-9]
b
ls a*.??#
c
cat a*.??[0-9]
d
cat a?.**#
14 In ksh, what is the difference between the expressions VAR and $VAR?
a
VAR refers to a variable name and $VAR to its value
b
VAR refers to a variable value and $VAR to its name
c
VAR refers to an integer variable and $VAR to a string variable
d
both expressions refer to the same thing
15 What is the effect of the command alias up2="cd ../.."?
a
typing "cd ../.." at a shell prompt causes the shell to print "up2"
b
typing "up2" at a shell prompt takes you up two levels in the directory tree
c
an error message is printed
16 Which of these situations would cause an error message to be printed after typing the command
"my_script" on the command line, assuming that my_script is a ksh script?
a
my_script does not have execute permission set
b
the current working directory is not in the PATH
c
both a) and b)
d
neither a) nor b)
17 In a ksh script, how does one indicate the beginning and end of a block of statements in a while
loop?
a
with { and }
b
with [ and ]
c
with while and elihw
d
with do and done

18 What is the command to search all files in your current directory for the word "plasmodium"?
a
grep plasmodium *
b
find plasmodium -all
c
lookup plasmodium *
19 How do you print the first 15 lines of all files ending by ".txt"?
a
print 15 .txt
b
cat *.txt -length=15
c
head -15 *.txt
20 Count the files you own in all your directories.
a
ls -lR | grep myusername | wc -l
b
ls -a | cnt *
c
ls -n ~myusername

You might also like