General Flashcards
Do you know the basic differences between Red Hat and CentOS?
Centos is free but is community supported, while redhat isn’t free but has support (for troubleshooting) provided by paid vendors. Centos for individual personal use, redhat for corporate use.
Why would you prefer Linux over Windows or any other operating system?
Linux is open source,
secure, multitasking, light weight, provides more uptime, less vendor dependency.
Which RHEL versions are you familiar with?
RHEL 7, 8, 9
Which ticketing system are you familiar with?
Jira
What is the structure of Linux, or what are the core components of the Linux OS?
The structure of Linux, or the core components of the Linux OS, typically includes:
Kernel: The core of the operating system that interacts with the hardware and manages system resources.
Shell: The interface that allows users to interact with the operating system through command-line commands or scripts.
Filesystem: The hierarchy of directories and files that store data and programs. Libraries: Collections of precompiled functions and routines that applications can use.
Utilities: Various command-line and GUI tools for managing the system and performing tasks.
Processes: Running instances of programs or commands that perform tasks.
What is the difference between shell and Kernel?
shell is the interface between the user and the
kernel.
kernel is an interface between the shell and hardware.
Which commands do you use on a routine basis?
uname, ifconfig, lsblk, du, df, hostname, w, who,
uptime, top, ps, nmcli
How can we check the hostname?
hostname, hostnamectl
What is the command to check the OS release?
cat /etc/os-release, cat /etc/redhat-release
How can you find out the kernel version of a Linux system?
uname -r
What is the difference between “su” and “su -“?
su: switch users to a new user by adding a shell, while keeping the environment (home directory for example) of the PREVIOUS user.
su -: switch users to a new user by adding a shell, while maintaining the environment (home directory for example) of the NEW user.
Which command do we use to get the commands you executed recently?
history and up arrow
What are binaries, and where are they stored?
Binaries are executable files written in binary code.
They are stored in /bin for the regular user, and system binaries are stored in /sbin.
What is the purpose of the /boot and /etc directories?
/boot – booting files
/etc – configuration
files
What does the /proc file system contain, and what is the size of this file system?
virtual file system
with 0 byte size. contains the kernel related files. it does not take space from the disk.
What is the basic difference between the /bin and /sbin directories?
/bin stores user binaries
/sbin stores system binaries
Which file system contains system configuration files?
/etc
What is the path to the directory that contains environmental files?
/etc/skel
Do you know how to execute multiple commands in a terminal?
; semicolon to separate commands and execute them in one go. -exec with find
Where are system binaries kept?
/sbin
What does the /opt directory/file system contain?
contains the optional or third party tools
What information can we extract from the uptime command?
current time of the system, how long system is up, no. of users logged in, load average at 1, 5 and 15 minutes.
What is the command to list all logged-in users and the time the server has been up for?
w, who
w
command is more organized and gives more information
What types of different timings are kept in record by Linux for files and directories, and which command would exhibit that information?
stat <filename> gives the
access (last time file was opened)
modify (change contents)
change (change metadata)</filename>
What is the pwd command used for?
present working directory, helps navigatae where you are
in the system
What is the difference between / and /root?
/ is the root filesystem, biggest.
/root is the home directory of root user
How can we create a directory?
mkdir directory-name
What does directory structure mean?
In computing, the way the operating system arranges files and directories
How to create a directory structure /dev/app/apache?
mkdir -p /dev/app/apache
What does the -p flag mean in mkdir?
-p flag provides or creates the directory structure. parent
How can you list the directory tree structure?
tree command.
tree directory-name
How can we update the time stamp of an existing file?
touch file-name
How can we long list files and sort by time stamp?
ls -lt
How can we recursively show the contents of the directory and sub- directory in the form of long list?
ls -lR
Difference between “>” and echo “»” sign.
> will overwrite if the contents are already there
> > will append the contents.
What is the difference between appending to a file Vs overriding a file, and how would you do that?
existing contents will still be in file, new contents will be added
overwrite the existing contents.
Let’ say /var is 95% utilized, how would you know which files/dir(s) are consuming the most space under /var?
du -h /var | sort -rh | head
How would you nullify/truncate the contents without deleting the file?
echo > filename or
> filename
For a given directory structure “/tmp/users/data” you are required to delete the Users directory and everything underneath it (recursively without getting prompted).
rm -rf /tmp/users
What is metadata? Where is metadata of a file or directory stored?
Metadata is data about data, such as information about a file or directory (permissions, ownership, timestamps (atime, mtime, ctime), size, and file type)
It’s stored within the inode (index node) associated with each file or directory
How to list the metadata of a file or directory?
stat file or directory name
How to find out the free inode numbers on /boot file system?
df -ih /boot
How to know the type of a file whether if it is a file, directory or archive?
file file name
How can we copy a file or directory while preserving the time stamp?
cp -p file or directory name
How to read 2 different files and redirect the output into one larger file?
cat file1 file2»_space; file3
What is the head command? How many lines does it show by default?
it reads the file from the top and by default prints the first ten lines
What is tail command? How many lines does tail command show by default?
it reads the file from
the bottom and by default prints the last ten lines
What is the difference between “/var/log/secure” and “/var/log/messages”?
security and authentication logs
system error related logs
What is the path to the system error logs?
var/log/messages
What information /var/log/dmesg or command dmesg contain?
hardware related logs, info about
hardware. boot related logs as well
How do you list the block devices?
lsblk
What are the slowest and fastest components of the system?
hard disk is slowest, cpu is fastest
Why do we need RAM if we have the hard disk for storage?
a very essential and critical component provides fast and temporary storage since hd cannot match the speed of the cpu, compliments the
disk
When RAM gets full where does data go?
swap space
How can we get the Swap space available in system?
free -h, swapon –show
What is swap space and where does it resides?
virtual memory on the hard drive
What is the purpose of df command?
report the filesystem disk usage space. whole system. system
wide disk utilization
How would you make df command human readable?
df -h
What is the purpose of du command?
disk usage or utilization of particular directory or filesystem
How can we get the disk utilization of a /tmp directory?
du -sh /tmp
How can you know that user is allowed to write in the file or not?
ls -l file will give the permissions.
stat
List the last 15 messages from the file which contains authentication/security logs?
tail -15
/var/log/secure
How can we get the real time updates in /var/log/secure file?
tail -f /var/log/secure