Q2) Write a command to find all of the files which have been accessed within the last 30 days.
A1) The Command is , find / -atime +30
A2) # find / -type f -mtime +30
A3) find / -type f -mtime -30
A4) find / -type f -atime -30 = accessed
find / -type f -ctime -30 = changed
find / -type f -ctime -30 = modified
Q3) How to schedule cron backup to run on 4th saturday of month??
A1) crontab -e
** ** ** ** /5
Q4) how to see unallocated hard disk space on linux
A1) simply type
A2) df -h /dev/devicename
device name could be hda,sda
Q5) find out what file systems supported by kernel?
A1) # fdisk /dev/hdx
it will show the supported FS in the kernel
A2) cat /proc/filesystems
will show all the file system types that the kernel can
handle currently. Be aware that kernel will load the
necessary modules automatically if it have, for a new file
system type present in a new device you plug into it and
then the output of the above command will vary.
A3) you can give following commands
then press t
this command will show all the file system with code
supported by the current linux kernel.
Q6) how do u extract files from iso cd images in linux?
A1) From ISO MAGIC
A2) mount -o loop
A3) mount -t iso9660 -o ro,loop=/dev/loop0 /home/ste/cd.iso /mnt/iso
Q7) how do u find remote machine operating system and version?
A2) by ssh to that machine then give command
A3) for OS,
cat /etc/issue and version, uname –r
Q8) how do you port scaning with netcat command?
A1) nc -z
Q9) how do find all failed login attempts via ssh?
A1) check network connectivity check correct ipaddress
A2) ‘who’ or ‘w’ is the command used to find the users who logged in
The system and their attempts, with the help of some options
A3) Failed ssh logs are either written in /var/log/messages, or
/var/log/secure (configurable in /etc/syslog.conf). I am
assuming that the failed login attempts are recorded in
grep ‘ authentication failure’ /var/log/secure | sed -e
‘s/^(.*)(rhost.*)$/2/p’ | tr -s ” ” | cut -f2 -d”=” |
cut -f1 -d” ” | sort -n | uniq -c
Will show you the count, and the IP/hostname of machines that tried
to access the system via ssh
A4) The command is ,
cat /var/log/messages | grep “Failed password”
it will show all the user which is not able to login.
Q10) How do display error messages instantly when command fails?
A1) Suppose you are trying to cat a non existing file:
cat /etc/shado 2>/dev/null || echo “Failed to open file”
command 2 “echo” is executed only if command 1 “cat” returns
a non-zero exit status
# cat /etc/shado 2>/dev/null || echo “Failed to open file”
Failed to open file
Q11) How do find hard disk revolutions speed?
A1) A typical desktop hard disk rotate at 7,200 revolutions per
minute (RPM). A typical server hard disk spin at 10,000 or
15,000 rpm to achieve sequential media transfer speeds. You
can use hard disk model number to obtain disk RPM. For
example, a typical Seagat disk Model #
provide following information:
* ST – Brand identity
* 3 – Form Factor (3 = 3.5″)
* 73 – Disk size / Capacity in GB i.e. 73GB
* 4 – Reserved for future use
* 5 – RPM ( 5 = 15k and 0 = 10K)
* 5 – Generation
* SS – Indicates interface i.e Serial Attached SCSI
How do I find out hard disk model and serial number?
Use any one of the following command from shell prompt to
find out hard disk model number:
$ cat /proc/scsi/scsi
OR use scsi_id command to querys a SCSI device via the SCSI
INQUIRY vital product data (VPD) page 0x80 or 0x83 and uses
the resulting data to generate a value that is unique across
all SCSI devices that properly support page 0x80 or page 0x83.
$ /sbin/scsi_id -g -p 0x80 -s /block/sdd
$ sudo grep -i sdd /var/log/boot.log
OR use sginfo / scsiinfo command from sg3_utiles package, enter:
# sginfo -a /dev/sdd | more
Q12) when zombie process fully cleared?
A1) When the server gets restarted!
A2) Do a ps and identify the zombie processes
# ps -el | grep ‘Z’
Occasionally, these processes are in such a state that the
only way to get rid of them is to reboot to clear them.
In most cases, you can get rid of a zombie by normal means,
“kill -15 zombie PPID”, “kill -9 zombie PPID”.
Q13) how do you configure linux system as a router?
A1) Give the following command
echo 1 > /proc/sys/net/ipv4/ip_forward
A2) above anwser also write,
but must me know this,
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
Q14) Which priority has the process?how do u
A1) nice command is used to find the priority
A2) Each process has a niceness value associated with it, which
is what the kernel uses to determine which processes require