Types Of Journals And Their Function?
Ordered : This is the default and journal only meta-data
Journaled : Journals data and meta-data
Writeback : Journal updates are not atomic.
What Is Swap Space?
Swap space is supplement to system RAM.
What Is The Function Of /etc/fstab?
This file is referenced each time the system boots to create the desired filesystem hierarchy.
How To Display The Label For A Device (/dev/hdb2)?
# e2lable /dev/hdb2
What Is The Function Of E2label Command?
With the help of e2label command a filesystem label can be written into the superblock of ext2/ext3 filesystem.
Eg:- #e2label /dev/hda3 datadisk3
Will create a label of datadisk3 on the filesystem on partition /dev/hda3.
How To View Only The Mounted Filesystems?
Use the df -k command, which shows only mounted filesystems but has the big advantage of giving you the mount points too.
How To View All The Mounted And Unmounted Partitions?
Use the fdisk -l command to view all the mounted and unmounted filesystems available on your system.
How To Kill All Actions On A Filesystem?
# fuser -km mnt_point
How To Display Who/what Is Acting On A Filesystem?
# fuser -v mnt_point
Which Command Is Used To Display Information About The Processes Using A Filesystem?
The fuser command is used.
Change the /etc/fstab to specify ext3 for desired filesystem(s)
Create the ext3 journal on the ext2 filesystem(s) as
# tune2fs -j
If the kernel needs to have access to the ext3 module at boot time, create a new initial ramdisk as
# mkinitrd /boot/initrd-.img
What Are The Journaling Modes Supported By Ext3 Filesystem?
Ordered>Journals only metadata (This is the default)
Journaled>Journals data as well as metadata
Writeback> Journal updates are not atomic, but this gives better performance.
What Is The Difference Between Ext2 And Ext3 Filesystem?
ext3 filesystem supports journaling, where as ext2 does not.
What Is The Use Of “$?” Sign In Shell Script?
While writing a shell script, if you want to check whether previous command is executed successfully or not, then we can use “$?” with if statement to check the exit status of previous command.
Basic example is shown below
root@localhost:~# ls /usr/bin/shar
/usr/bin/shar
root@localhost:~# echo $
0
If exit status is 0 , then command is executed successfully
root@localhost:~# ls /usr/bin/share
ls: cannot access /usr/bin/share: No such file or directory
root@localhost:~# echo $
2
If the exit status is other than 0, then we can say command is not executed successfully.
How To Compare Numbers In Linux Shell Scripting?
Test command is used to compare numbers in if-then statement.
Example is shown below
#! /bin/bash
x=10
y=20
if [ $x -gt $y ]
then
echo “x is greater than y”
else
echo “y is greater than x”
fi
What Is The Use Of Break Command?
The break command is a simple way to escape out of a loop in progress. We can use the break command to exit out from any loop, including while and until loops.
What Are The Different Type Of Variables Used In A Shell Script?
In a shell script we can use two types of variables
System defined variables
User defined variables
System defined variables are defined or created by Operating System (Linux) itself. These variables are generally defined in Capital Letters and can be viewed by “set” command.
User defined variables are created or defined by system users and the values of variables can be viewed by using the command “echo $<Name_of_Variable>”.
How To Redirect Both Standard Output And Standard Error To The Same Location?
There two methods to redirect std output and std error to the same location
Method:1 2>&1 (# ls /usr/share/doc > out.txt 2>&1 )
Method:2 &> (# ls /usr/share/doc &> out.txt )
What Is The Syntax Of “nested If Statement” In Shell Scripting?
Basic Syntax is shown below
if [ Condition ]
then
command1
command2
…..
else
if [ condition ]
then
command1
command2
….
else
command1
command2
…..
fi
fi
The basic syntax is shown below
case word in
value1)
command1
command2
…..
last_command
!!
value2)
command1
command2
……
last_command
;;
esac
How To Put Comments In Your Shell Script?
Comments are the messages to yourself and for other users that describe what a script is supposed to do and how its works. To put comments in your script, start each comment line with a hash sign (#).
Example is shown below
#!/bin/bash
# This is a command
echo “I am logged in as $USER”
Ordered : This is the default and journal only meta-data
Journaled : Journals data and meta-data
Writeback : Journal updates are not atomic.
What Is Swap Space?
Swap space is supplement to system RAM.
What Is The Function Of /etc/fstab?
This file is referenced each time the system boots to create the desired filesystem hierarchy.
How To Display The Label For A Device (/dev/hdb2)?
# e2lable /dev/hdb2
What Is The Function Of E2label Command?
With the help of e2label command a filesystem label can be written into the superblock of ext2/ext3 filesystem.
Eg:- #e2label /dev/hda3 datadisk3
Will create a label of datadisk3 on the filesystem on partition /dev/hda3.
How To View Only The Mounted Filesystems?
Use the df -k command, which shows only mounted filesystems but has the big advantage of giving you the mount points too.
How To View All The Mounted And Unmounted Partitions?
Use the fdisk -l command to view all the mounted and unmounted filesystems available on your system.
How To Kill All Actions On A Filesystem?
# fuser -km mnt_point
How To Display Who/what Is Acting On A Filesystem?
# fuser -v mnt_point
NetEase Frequently Asked Linux Interview Questions Answers |
Which Command Is Used To Display Information About The Processes Using A Filesystem?
The fuser command is used.
How To Convert An Ext2 Filesystem To Ext3?
Change the /etc/fstab to specify ext3 for desired filesystem(s)
Create the ext3 journal on the ext2 filesystem(s) as
# tune2fs -j
If the kernel needs to have access to the ext3 module at boot time, create a new initial ramdisk as
# mkinitrd /boot/initrd-.img
What Are The Journaling Modes Supported By Ext3 Filesystem?
Ordered>Journals only metadata (This is the default)
Journaled>Journals data as well as metadata
Writeback> Journal updates are not atomic, but this gives better performance.
What Is The Difference Between Ext2 And Ext3 Filesystem?
ext3 filesystem supports journaling, where as ext2 does not.
What Is The Use Of “$?” Sign In Shell Script?
While writing a shell script, if you want to check whether previous command is executed successfully or not, then we can use “$?” with if statement to check the exit status of previous command.
Basic example is shown below
root@localhost:~# ls /usr/bin/shar
/usr/bin/shar
root@localhost:~# echo $
0
If exit status is 0 , then command is executed successfully
root@localhost:~# ls /usr/bin/share
ls: cannot access /usr/bin/share: No such file or directory
root@localhost:~# echo $
2
If the exit status is other than 0, then we can say command is not executed successfully.
How To Compare Numbers In Linux Shell Scripting?
Test command is used to compare numbers in if-then statement.
Example is shown below
#! /bin/bash
x=10
y=20
if [ $x -gt $y ]
then
echo “x is greater than y”
else
echo “y is greater than x”
fi
What Is The Use Of Break Command?
The break command is a simple way to escape out of a loop in progress. We can use the break command to exit out from any loop, including while and until loops.
What Are The Different Type Of Variables Used In A Shell Script?
In a shell script we can use two types of variables
System defined variables
User defined variables
System defined variables are defined or created by Operating System (Linux) itself. These variables are generally defined in Capital Letters and can be viewed by “set” command.
User defined variables are created or defined by system users and the values of variables can be viewed by using the command “echo $<Name_of_Variable>”.
How To Redirect Both Standard Output And Standard Error To The Same Location?
There two methods to redirect std output and std error to the same location
Method:1 2>&1 (# ls /usr/share/doc > out.txt 2>&1 )
Method:2 &> (# ls /usr/share/doc &> out.txt )
What Is The Syntax Of “nested If Statement” In Shell Scripting?
Basic Syntax is shown below
if [ Condition ]
then
command1
command2
…..
else
if [ condition ]
then
command1
command2
….
else
command1
command2
…..
fi
fi
Tell Me The Syntax Of “case Statement” In Linux Shell Scripting?
The basic syntax is shown below
case word in
value1)
command1
command2
…..
last_command
!!
value2)
command1
command2
……
last_command
;;
esac
How To Put Comments In Your Shell Script?
Comments are the messages to yourself and for other users that describe what a script is supposed to do and how its works. To put comments in your script, start each comment line with a hash sign (#).
Example is shown below
#!/bin/bash
# This is a command
echo “I am logged in as $USER”
Post a Comment