Exercise #26 (outputs)

BEGINNERS EXERCISE :

What are the outputs of the following commands :

name="LinuxExercise"

A. echo ${name}

B. echo ${name/J/j}

C. echo ${name:0:2}

D. echo ${name::2}

E. echo ${name::-1}

F. echo ${name:(-1)}

G. echo ${name:(-2):1}

H. echo ${food:-Cake}

Exercise #23 (pwd)

What is the pwd command?

Exercise #21 (bulk)

1. Use rsync to synch backup.tar.gz locally into the /home/exercise/ folder...

2. Command to sync all files from /home/sourcedir/ onto a remote machine (192.168.0.10) into the /home/targetdir/ folder

3. Copy/sync a File from a Remote machine to a Local machine with Rsync / SSH, what's the command to achieve this ?
Server IP: 10.5.5.10
Source Directory and file: /home/mysource/backup.tar.gz
Target local directory : /home/targetdir/

4. Is it possible to use rsync only to copy files from a remote source to a remote destination ?

5. What's the command to transfer files between 2 REMOTE locations, HOST1 and HOST2 using ssh and rsync

HOST1 hostname : myremotehost
HOST2 hostname : yourremotehost
HOST1 source directory : /home/myremotehost/sharedfiles/
HOST2 target directory : /home/yourremotehost/received/

Exercise #20 (commands)

1. What, if anything, is wrong with each of the following commands?
a) ls -l-a
b) cat file1, file2
c) ls - s /etc

2. What is the command to calculate the size of a folder?

3. What's the command that will display all .txt files, including their individual permission.

4. How do you terminate all running processes at once ?

5. How can you find out how much memory Linux is using? (if you can, give us more than one examples)

Exercise #19 (memory)

How many ways can you check the available free memory under Linux terminal ?

Exercise #16 (top)

Which of the following actions can be run from the top command? (Choose two.)
A. New processes can be started
B. Killing a process by its PID
C. A process can be given a lower priority
D. Reboot the system
E. Measure the free space on the hard drive

Exercise #15 (vi)

Select all the ways of saving and exiting a vi session. (Choose more than one)

A. :exit
B. Shift ZZ
C. :ZZ
D. :x
E. :w
F. :wq

Exercise #14 (Security)

What command will set a regular users password to force changing it every 90 days? Choose all that apply.
A. useradd –e 90 linuxuser
B. chage –M 90 linuxuser
C. passwd +x 90 linuxuser
D. usermod –f 90 linuxuser
E. passwd –x 90 linuxuser

Exercise #13 (permission)

A file named linuxexercises.odt has a mode of rw-r- -r- -. If linuxuser is the file's owner, what can he do with it?
A. He can open the file and view its contents, but he can't save any changes.
B. He can open the file, make changes, and save the file.
C. He can change ownership of the file.
D. He can run the file if it's an executable.

Exercise #12 (permission)

Describe three different ways of setting the permissions on a file or directory to r--r--r--

Exercise #11 (umask)

Type umask 000 and then create a file called linux.txt containing the words "Linux Exercise". Look at the permissions on the file. What's happened? Now type umask 022 and create a file called linux2.txt. When might this feature be useful?

Exercise #10 (umask)

Your current unmask is set to 002. If you create a new file, what will the permission of the new file be?
A. ------w-
B. rwxrwx-w-
C. -rw-rw-r—
D. rwxrwxr-x

Exercise #9 (accounts)

How to count local accounts ?

Exercise #6 (cron)

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
23 4 * 1,6 1 root run-parts /etc/cron.special

Refer to the '/etc/crontab' file listed in the exhibit for this question. Which of the following statements is true? Explain your answer.

A. The script file '/etc/cron.special is run once a week, on
Mondays.

B. The contents of the '/etc/cron.special directory are run
during January and June.

C. During some parts of the year '/etc/cron.special' is run
one minute after '/etc/cron.weekly'.

D. During the month of March, '/etc/cron.special' is run on
Mondays.

Exercise #5 (log)

How to view all messages generated by the system since the last reboot on RHEL7/CentOS 7?

← Older posts