Linux interview Questions
Linux inetrview questions:
1).How can I revoke file permission on a dirextory or a file for one user?
so if you want to revoke the file permiison,
so we can execute the command like as the,
chmod o-x filename
so in this way we can revoke file permission or a
directory permissions from a one user.
which means the acl is set on this file . so that's why patrticular user doesn't access the
file
if you are listing the file , we can see the +1 options which means , the acl is enable on this file
2).
any files are ends with +1 which means we are enable on the
acl on this particular file or directory
all userss having the access for the files and directory
but ram users are doesn't . because the acl or enable on this file
3).how to setfacl ,getfacl amd sticky bit in linux os ?
we can execute the command like as the,
setfacl -m u:ram:rwx filename
in this way we can set it to the acl on this particuat
file
4)how to check if acl is etting on this pativulat file1
we can execute the command like as the
getfacl filename
it will list out the what is the fileanme
who is user
who is yje owner of this file
then it will display the permssions for userss ,group and others
chattr command:
once the chattr command is implemented on this file,
definirlty this file is not going to be deleted
its shows the opratiosn not permitted
once chattr command on remove on this file ,
the file will be automatically deleted
lsattr
it will lsit out the file attributes
6).How can i inherit group on filesystem?
so we can execute the comamnd likea sthe ,
fist we ned to crtae the group called as the
groupadd comamnd
next we need to carete the directory
chmos g+s test / -R
in this way we can inherit the group on filesystem
next we can execute the command like asthe ,
chown jeey rest/
now give ll
yes successfully the group inherited into filesystem
7).How cna i ebanble acl on this filessyetm?
setfacl -m u:ram:rwx filename
in this way we can enable the acl on this filesystem
or else if you want to check it out the whather the acl is enable on file or not ,
so we can execute the comand like as the,
getfacl file or filesystem command in linux os
8).How can I set quota for a user in linux?
edquota username
set quota for a user:
edquota -g groupname
if you want to check the user having the quota or not we have to check it out the
cat /etc
u can ebale quota into fstab filessytem
9).what is the differnece between sgib and suid in linux ios?
values for suid and sgid and stickybit
suid =4
sgid=2
stickybit =1
chmod u+s filename
chmod g+s hilename
suid:
this is specila permisisn . this permisison enables on the
partoicular enable on the exdcutables files. once this suid permission is enable on the executanle
files , then normal user gettimg temprity priviliges accesss to the file owner or root owner.
sgid :
particilar user enable on the excutanle file and directories . once this permsiion is enable on the
executable file or directories then normal user getetn tempeiry priviliges access to group ownership
10).
monitroing and managing the linux process:
1).How to check the all running process in linux os?
top
ps -ef
in this way we can check it out the all running process in linux os
2).How can I chnage the priroty of running process?
we can execute the command like as the,
renice nicevalue processid
3).what is the range of nice value in linux os ?
-20 to +20
-20 means = hightest nice value
+20 means = lowest nice value
normal user can set it -19 to +19
root user can set it -20 to +20
4).how can I check the states of process?
we can execute the command like as the,
top command
here only we can figure it out .
we have four states are there.
running,sleeping,stopped and zombie
5).How can I check when process was started ?
we can execute the command like asthe ,
ps -ef command . so in this way we can get it the when process was started.
6).How can I check how much cpu and memeory a process is utilizing?
we can execute the top comamnd . so in this way we can figure it out easily
top it will list out the how much memeory and cpu is consuimng
so in this way we can figure it out which process is consuming more cpu and more memeory
that's what top comamnd is used in linux os
---------------------------------------
editor :
1)what is the difference between vi and vim editor in linux os ?
both are editors . snd then strings will be different.
vim and vi command those user's user id's less then 200
2).what are the modes are avilbe into vim editor?
insert mode
command mode
execution mode
3).
How will you copy/delete/edit/lines in vim edirot?
4).How will you replace an string in vim editor?
:%s/select that word which you want to chnage/nandhini/g
5).How to run linux terminal command if you are in vim
editor?
: ! ls /tmp
6).How to compare two files using vim ?
vimdiff /etc/passwd /etc/fstab
so in this way we can caompare the two files using vim edirot
7).How do i search text in vim?
we can execute the command like as the ,
open the an file in linux os
cat /etc/passwd
bottom of the file , we can type the any word
/root = so in this way we can find the words into
/etc/passwd file
8).How to enter into insert mode from command mode in linux so?
press i .so in this way we can enter into insert
mode from command mode in linux os
9).shdecling inux jobs:
1).How to list corntab entries?
crontab -l command . so in this way we can get the list
of corntab entries.
2).How to list the crontab entries for particular user?
we can execute the comamnd like asthe ,
crontab -lu root
3).How to remove crontab entries from a particular user?
crontab -ru nandhini
so in this way we can execute the crontab entries form
a particular user.
4).How to run multiple commands with single corn?
we can execute the command like asthe ,
crontab -e command
so open this file .
here type the ,@reboot df -TH &&& ping c 4 8.8.8
so save this file,
at the reboor of you rlinux server , this command is executed at four times.
one command is executed suucessfully and other command is
executed
5).what are common strings for cron schdule?
miniture (0-59)
hour(0-23)
day of month(1-31)
month of year(1-12)
day of week 1-6, 0,7 = sunday
then command
6).How to schedule systemwide corns?
if am going to particular directory called as the ,
cd /etc
then give ls cron command
then it will list out the cron using
like monthly ,hourly,weekly,yealry
deny ,d
in this way we can figure it out systemwide corns
7).How to enable confirmations with cron?
if you want to get the notifications , we can schedule
the crons .obviously we can get the confirmations
8).can you schedule a cron that should run every sunday
12:30 am?
crontab -e command
here we need to edit like as the,
30 12 * * 0 command
9).accessing control lists -control access to files:
1).where do we use chmod and setfacl command in linux os?
chmod command : changing the file permissions
using this command we can change the file permissions:
so we can execute the command like as the,
chmod 444 filename.1
setfacl -m u:ram:rwx filename
2).How to check if there is an acl implemented on a file?
we can executed the command like as the ,
getfacl filename
in this way we can get the information's about acl is implements on this file.
3).How to change default attribute of the file?
lsattr username or filename'
it will display the file attribute
we need to execute the vommand like as the
chattr +i filename
now am going to remove the file
rm -rf filename
its shows pertons not permitted
once am going to remove the chattr command on this
'file , now the file will be deleted
4).How to modify access time of a file?
we can execute the command like as the,
touch --reference /etc/passwd nandhini
5).can i chnage modify time of a file to some
past date?
yes we can change it .
touch --reference /etc/passwd root
6).How to check total number.of disk in linux os?
we can execute the command like as the,
fdisk -l command
lsblk command
df -Th command
blkid command :
which is used to list out avilable partitions are formatted and
associated filesystems in linux os.
7).How to check uuid of a disk?
8).what is file is used to mount disk parmaently?
we can execute the command like as the,
vi /etc/fstab command
9).what is the use of fdisk command in linux os?
it will list out avilibity partitions in the linux os
10).How to create and reduce extend lvm in linux os ?
11).How to check who modified this file?
we can install the aide tool
using this tool we can findout the who midifed this file
next we can execute the command like as the .
ll -l filename or ls -l filename
12).what is the command to cheack the file modifications time in linux os ?
we can execute the command like as the ,
ls -l filename
so in this way we can check it out the file modificatons time in inux os .
13).how will fond the files conating string word?
we can execute the command likea sthe
grep command
grep -n1 /etc/passwd
grep root /etc/passwd
14).How do you dealing with mount parttions in linux os?
we can exdcute the command like as the,
findmnt command
cat /proc/mounts
15).How to check on os is running on virtual of physical machine in linux os?
dmidecode | grep -i vm command
16).How to remove an inode from an linux os ?
17).how do you repair linux partitions in linux os?
18).How to clear a partition in Linux?
To delete a partition using the fdisk utility, you must first log into your system as root or use the sudo command to gain superuser privileges.
Then, you can run the fdisk command with the appropriate options to delete the desired partition.
19)How do I unmount all partitions in Linux?
sudo mount -av
20).whar are the partions are available in linux os ?
primary
extened
Comments
Post a Comment