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 filesystem
9).what is the difference between sgib and suid in linux ios?
values for suid and sgid and sticky bit
suid =4
sgid=2
stickybit =1
chmod u+s filename
chmod g+s filename
suid:
this is specila permission . this permission enables on the
particular enable on the executables files. once this suid permission is enable on the executable
files , then normal user getting temprity privilege's access to the file owner or root owner.
sgid :
particular user enable on the executable file and directories . once this permission is enable on the
executable file or directories then normal user getetn tempeiry privileges' access to group ownership
10).
monitoring 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 change the priority of running process?
we can execute the command like as the,
renice nice value processeid
3).what is the range of nice value in linux os ?
-20 to +20
-20 means = highest 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 as the ,
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 memory a process is utilizing?
we can execute the top command . so in this way we can figure it out easily
top it will list out the how much memory and cpu is consuming
so in this way we can figure it out which process is consuming more cpu and more memory
that's what top command is used in linux os
---------------------------------------
editor :
1)what is the difference between vi and vim editor in linux os ?
both are editors . and then strings will be different.
vim and vi command those user's user id's less then 200
2).what are the modes are avilabe into vim editor?
insert mode
command mode
execution mode
3).
How will you copy/delete/edit/lines in vim editor?
4).How will you replace an string in vim editor?
:%s/select that word which you want to change/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 compare the two files using vim editor
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 crontab entries.
2).How to list the crontab entries for particular user?
we can execute the command like as the ,
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 schedule?
miniature (0-59)
hour(0-23)
day of month(1-31)
month of year(1-12)
day of week 1-6, 0,7 = sun day
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 cna figure it out systemwide corns
7).How to enable confirmations with cron?
if you want to get the notifications , we can schdule
the crons .obiicously we can get the confirmations
8).can you schedule a cron that sholud run every sunday
12:30 am?
crontab -e command
here we need to edit like as the,
30 12 * * 0 command
Comments
Post a Comment