Lab – Linux Question Answer – Part I
Linux Question Answer
1) Displays kernel release information?
uname -r
2) Displays when the system is up?
uptime
3) Display ipaddress and hostname
hostname hostname -i
4) Displays currently logged in users in the system
w
Hardware
5) Displays OS bootup messages
dmesg
6) Displays more information about CPU and Memory
cat /proc/cpuinfo & lscpu cat /proc/meminfo
7) Displays the details of the active user e.g. uid, gid, and groups
id
Users
8) Shows who is logged in to the system
who
9) How will you add user and group.
username : oracle group : Primary dba / secondary : oinstall
10) on Which file you check the added group and user.
cat /etc/passwd and /etc/group
File commands
11) List all file including hidden files in reverse order
ls -alrt
12) How will you rename a file
mv f1 f2
13) Removes a directory forcefully and recursively
rm -rf
14) Creates a symbolic link to file_name
ln -s /path/to/file_name link_name
15) Encrypts a file
gpg -c file_name
16) Decrypts a file
gpg file_name.gpg
17) Prints the number of bytes, words and lines in a file
wc
18) Executes commands from standard input
xargs
process related
19) Searches for the id of the process ‘pmon’
ps -ef|grep pmon
20) Lists files that are open by processes
lsof
21) Displays all running processes with utilization
top
22) How to execute a shell sripts in background.
./filename.sh &
23) How will you log the output from the bg process.
$ nohup ./filename.sh &
24) Change file permissions of the file to octal
chmod 777 filename
25) change owner and group of a directory and its subdirestories and files
chown -R oracle:oinstall directory
network
26) Displays all active listening ports
netstat -plunt
27) Check hostname reachability
ping hostname
28) copy a file from one linux to aother linux server
scp
29) copy a fle from windows to linux server
use winscp/sftp
30) Downloads a file from an online source
wget