Practice Questions
SARVAJANIK COLLEGE OF ENGINEERING AND TECHNOLOGY
COMPUTER ENGINEERING DEPARTMENT
Experiment No: 1
Aim: Study of basic Unix commands
1. Passwd
The passwd utility is used to update user’s authentication token(s).
This task is achieved through calls to the Linux-PAM and Libuser API.
Essentially, it initializes itself as a "passwd" service with Linux-PAM
and utilizes configured password modules to authenticate and then
update a user’s password.
Output:
[root@SAR056 ~]# passwd
Changing password for user root.
New password:
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@SAR056 ~]# passwd
,Changing password for user root.
New password:
BAD PASSWORD: it is WAY too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
2.Pwd
Print the full filename of the current working directory.
Output:
[root@SAR056 ~]# pwd
/root
3.Apropos
apropos searches a set of database files containing short descriptions
of system commands for keywords and displays the result on the standard
output.
Output:
man apropos
[root@SAR056 ~]# apropos gedit
gedit (1) - text editor for the GNOME Desktop
4.Su
Change the effective user id and group id to that of USER.
5.Ssh
ssh (SSH client) is a program for logging into a remote machine and for
executing commands on a remote machine. It is intended to replace rlogin
and rsh, and provide secure encrypted communications between two
untrusted hosts over an insecure network. X11 connections and arbitrary
TCP ports can also be forwarded over the secure channel.
, xxxx ssh connects and logs into the specified hostname (with optional user
x x x x x x x x x x
xxxxx name). The user must prove his/her identity to the remote machine using
xx x x x x x x x x x x
xxxxx one of several methods depending on the protocol version used (see
x x x x x x x x x x
xxxxx below).
xxxxx If command is specified, it is executed on the remote host instead of a
x x x x x x x x x x x x x
xxxxx login shell. x
Output:
ssh 172.16.1.57
x
The authenticity of host '172.16.1.57 (172.16.1.57)' can't be established.
x x x x x x x x
RSA key fingerprint is 05:1a:87:7f:39:9b:5a:e8:34:91:db:0d:24:9c:00:83.
x x x x
Are you sure you want to continue connecting (yes/no)? yes
x x x x x x x x x
Warning: Permanently added '172.16.1.57' (RSA) to the list of known hosts.
x x x x x x x x x x
root@172.16.1.57's password: x x
[root@SAR057 ~]# ls x x x
170420107045 bin exam Public s17cos23.sql Videos xxx xxxxxxxx xxxxxx xxxxxxxxxxxxxx xx
1 (copy).java Desktop lib s17cos116.sql2.sql share workspace
x xx xxxx xxxxxxx xx xxxxxxxxx
1.java Documents Music s17cos21.sql Studies
xxxxxxxxx xx xxxxx xxxxxxxx
1.java~ Downloads Pictures s17cos239.sql Templates
xxxxxxxx xx xx xxxxxxx
[root@SAR057 ~]# ssh 172.16.1.56 x x x
The authenticity of host '172.16.1.56 (172.16.1.56)' can't be established.
x x x x x x x x
RSA key fingerprint is 05:1a:87:7f:39:9b:5a:e8:34:91:db:0d:24:9c:00:83.
x x x x
Are you sure you want to continue connecting (yes/no)? yes
x x x x x x x x x
Warning: Permanently added '172.16.1.56' (RSA) to the list of known hosts.
x x x x x x x x x x
root@172.16.1.56's password: x x
Last login: Mon Jun 25 11:25:26 2018 from 172.16.1.55
x x x x x x x x
xxxx
6.Chown
xxxxxx This manual page documents the GNU version of chown. chown changes the
x x x x x x x x xx x x
xxxxxxx user and/or group ownership of each given file. If only an owner (a
x x x x x x x xx x xx xx xx
xxxxxxx user name or numeric user ID) is given, that user is made the owner of
xx x x x x x x x x x x x x x
xxxxxxx each given file, and the files’ group is not changed. If the owner is
x x x x x x x x x xx x x xx
xxxxxxx followed by a colon and a group name (or numeric group ID), with no
xx xx xx xx x x x x x x x x x
xxxxxxx spaces between them, the group ownership of the files is changed as
x x x x x x x xx xx xx xx
xxxxxxx well. If a colon but no group name follows the user name, that user is
xx x x x x x x x x x x x x x
xxxxxxx made the owner of the files and the group of the files is changed to
x x x x x x x x x x x xx xx xx
xxxxxxx that user’s login group. If the colon and group are given, but the
xx xx xx xxx x x x x x x x x
xxxxxxx owner is omitted, only the group of the files is changed; in this case,
x x x x x x x x x x x x x
, xxxxxxx chown performs the same function as chgrp. If only a colon is given,
xx xx x x x x xx x x x x x
xxxxxxx or if the entire operand is empty, neither the owner nor the group is
x x x x x x x x x x x xx xx
xxxxxxx changed.
Output:
[root@SAR056 Desktop]# ls -l x x x
total 72 x
drwxr-xr-x. 3 root root 4096 Jun 20 17:40 170420107543
xx x x xx x x x x
drwxr-xr-x. 4 root root 4096 Jun 11 15:13 8085 Simulator
xx x x xx x x x x x
-rw-r--r--. 1 root root 0 Jun 25 11:43 aayu
xx x x xxxxx x x x x
-rwxrwxrwx. 1 root root 371 May 22 11:19 AdobeReader.desktop
xx x x xxx x x x x
drwxr-xr-x. 12 root root 4096 May 22 14:56 Cisco-PT-711-x64
x x x xx x x x x
drwxr-xr-x. 2 root root 4096 Jun 21 17:44 CO2
xx x x xx x x x x
-rw-r--r--. 1 root root 43253 Jun 25 11:41 cs_16.odt
xx x x x x x x x
-rw-r--r--. 1 root root 288 Jun 18 15:33 s17cos243.sql
xx x x xxx x x x x
drwxr-xr-x. 2 root root 4096 Jun 19 17:24 VATSAL
xx x x xx x x x x
[root@SAR056 Desktop]# chown comp aayu x x x x
[root@SAR056 Desktop]# ls -l x x x
total 72 x
drwxr-xr-x. 3 root root 4096 Jun 20 17:40 170420107543
xx x x xx x x x x
drwxr-xr-x. 4 root root 4096 Jun 11 15:13 8085 Simulator
xx x x xx x x x x x
-rw-r--r--. 1 comp root 0 Jun 25 11:43 aayu
xx x x xxxxx x x x x
-rwxrwxrwx. 1 root root 371 May 22 11:19 AdobeReader.desktop
xx x x xxx x x x x
drwxr-xr-x. 12 root root 4096 May 22 14:56 Cisco-PT-711-x64
x x x xx x x x x
drwxr-xr-x. 2 root root 4096 Jun 21 17:44 CO2
xx x x xx x x x x
-rw-r--r--. 1 root root 43253 Jun 25 11:41 cs_16.odt
xx x x x x x x x
-rw-r--r--. 1 root root 288 Jun 18 15:33 s17cos243.sql
xx x x xxx x x x x
drwxr-xr-x. 2 root root 4096 Jun 19 17:24 VATSAL
xx x x xx x x x x
7.Top
The top program provides a dynamic real-time view of a running system.
xxxxxx xx x x x x x x x x x x
It can display system summary information as well as a list of tasks
xxxxxxx x x x x x x x x x xx xx xx
currently being managed by the Linux kernel. The types of system sum-
xxxxxxx xx x x x x x xx x x x x
mary information shown and the types, order and size of information
xxxxxxx x x x x x x xx xx xx xx
displayed for tasks are all user configurable and that configuration
xxxxxxx xx xx xx x x x x x x
can be made persistent across restarts.
xxxxxxx x x x x x
xxxxxxx The program provides a limited interactive interface for process manip-
x x x x x x x x x
xxxxxxx ulation as well as a much more extensive interface for personal config-
x x x x x x x x x x x