If you can see this check that

next section prev section up prev page next page

Essential Unix


Essential Unix commands

User:
Password:

We explore some of the basic unix commands such as ls, ps, chmod. From now on you must be logged in as root, not demo. Log out and log in as root NOW!

To reset all the check buttons from a previous attempt click here

Question 1: ls

Enter the number of entries in the top level directory. You can use the command ls / and simply count the words.

If you are too lazy to count you can pass the output through the wc command: ls /|wc

Enter a number:

Tests - not attempted
Count files and directories in / UNTESTED

Question 2: Edit

Edit the file /etc/motd so that it contains the single word Welcome You can use the echo command and redirect the output, or you can use an editor such as vi or nano (similar to pico). If you get a permission denied error ARE YOU SURE YOU ARE ROOT?

On some Windows machines, nano does not seem to like the cursor keys. If (and only if) the cursor keys result in funny characters when using nano, type the following at the prompt and then try nano again:

export TERM=vt102
This should get you going again. Silly Windows...

Tests - not attempted
Welcome in motd UNTESTED

Question 3: uid

Give the uid of the user called "operator".

Enter a number:

Tests - not attempted
uid of operator UNTESTED

Question 4: owner

Who is the owner of the directory /var/cache/httpd? If you get no information, are you sure you are using "ls" to give the directory information or the contents of the directory instead?

Enter the user name:

Tests - not attempted
owner of httpd UNTESTED

Question 5: permissions

Give the name of the first directory (alphabetically) of / that has no read permission for other.

Enter the directory name:

Tests - not attempted
inaccessible directory UNTESTED

Question 6: more permissions

Change the permission of the directory /var/log/httpd so that group and world have execute and read permission.

Tests - not attempted
access web log UNTESTED

Question 7: Change owner

Change the owner of the file /etc/ntp.conf to operator

Tests - not attempted
change owner UNTESTED

Question 8: Drop zone

Create a directory /root/dropzone It should be set up so that group and other users can save files in the directory, but they cannot read the files that are there. User root must able to read and write the directory.

Tests - not attempted
write only UNTESTED

Question 9: Linking files

Create a symbolic link so that the file /usr/share/dict/words appears as /root/words

Tests - not attempted
link to dictionary UNTESTED

Question 10: Word puzzle 1

This is a challenge question. Miss it out if you dont know regular expressions.

Use grep on words to find a word that contains each of the vowels in the correct order. How many such words are there? (you may include words with extra vowels such as adventitious. /root/words

Tests - not attempted
all vowels in order UNTESTED

Question 11: Word puzzle 2

This is a challenge question. Miss it out if you dont know regular expressions.

The word minglingly includes the same four characters (e.g. ingl) repeated. How many such words are there which also begin with lower case "m" (any four character are repeated).

Tests - not attempted
right number of words UNTESTED

Question 12: How much space...?

Look in /usr/share/doc and find a directory starting "git-" followed by a version number. In the following questions this directory is referred to as the "git" directory...

How much space is being used by the git directory? Use a command to calculate this, and dont try adding it up yourself! We want the total answer in human readable format (eg 6.2M).

Tests - not attempted
size of directory UNTESTED

Question 13: How much space is available?

In human readable form (eg 123M) how much disk space is available on the main filesystem?

Tests - not attempted
space free UNTESTED

Question 14: How much space is available?

Remove the entire git directory (it is not used in our tutorials). Now repeat the above calculation for disk space, but this time give the answer in blocks.

Tests - not attempted
directory gone UNTESTED
space free UNTESTED


Centos 7 intro: Paths | BasicShell | Search
Linux tutorials: intro1 intro2 wildcard permission pipe vi essential admin net SELinux1 SELinux2 fwall DNS diag Apache1 Apache2 log Mail
Caine 10.0: Essentials | Basic | Search | Acquisition | SysIntro | grep | MBR | GPT | FAT | NTFS | FRMeta | FRTools | Browser | Mock Exam |
CPD: Cygwin | Paths | Files and head/tail | Find and regex | Sort | Log Analysis
Kali: 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7a | 8a | 8b | 9 | 10 |
Kali 2020-4: 1a | 1b | 1c | 2 | 3 | 4a | 4b | 5 | 6 | 7 | 8a | 8b | 9 | 10 |
Useful: Quiz | Forums | Privacy Policy | Terms and Conditions

Linuxzoo created by Gordon Russell.
@ Copyright 2004-2023 Edinburgh Napier University