IT Questions and Answers :)

Friday, July 5, 2019

What is the name of the dynamic memory management system used by KVM (Kernel-based Virtual Machine)?

What is the name of the dynamic memory management system used by KVM (Kernel-based Virtual Machine)?

  • Kernel-based Memory Deduplication
  • Kernel-based Memory Optimization
  • KVM Dynamic Page Consolidation
  • Kernel Samepage Merging 

What is the name of the dynamic memory management system used by KVM (Kernel-based Virtual Machine)?

EXPLANATION

KSM (Kernel Samepage Merging) runs in the Linux kernel and scans the memory of all the virtual machines running on a single host, looking for duplication and consolidating said duplicates when found.
KSM is able to improve virtual machine density by as much as 300% without impacting performance. One of the great benefits of using Linux as the hypervisor means KSM is not limited to KVM and virtual machines, but can also reduce memory pressure with normal Linux applications.

SOURCE

https://pve.proxmox.com/wiki/Dynamic_Memory_Management
Share:

Tuesday, May 14, 2019

The linux admin inadvertently changed permissions on /usr/bin/ls, a 64-bit ELF executable, from 755 to 511. Which users are now authorized to execute "ls" from the command line?

The linux admin inadvertently changed permissions on /usr/bin/ls, a 64-bit ELF executable, from 755 to 511. Which users are now authorized to execute "ls" from the command line?

  • Only the owner and members of the group associated with the file.
  • User root, and only user root.
  • All users.
  • The owner, and only the owner. 
The linux admin inadvertently changed permissions on /usr/bin/ls, a 64-bit ELF executable, from 755 to 511. Which users are now authorized to execute "ls" from the command line?

EXPLANATION

How to change your file to 511 or -r-x--x--x using chmod

Chmod is a well known command line utility, that's used to manage file permissions on MacOS, Linux and other Unix like operating systems. While there are multiple ways to use chmod, on this site, we have chosen to focus exclusively on using chmod with Octal Notation. The following examples illustrate exactly how to change your desired file to permissions matching "511 or -r-x--x--x" using the command line and chmod. If you're lost on how to manually manage file permissions, see our guide - How Do I Change File Permissions Using chmod?

From your terminal run the following command, within a directory containing the file you wish to change permissions on. In this case the filename is "yourfile.txt"
$ chmod 511 yourfile.txt
Confirming your change, your file's symbolic permissions should now be "-r-x--x--x"
$ ls -l

# your output will be similar to the following
-r-x--x--x 14 root root 4096 Jun 22 07:36 yourfile.txt

 

/usr/bin/ls is an ELF 64-bit executable and "r"ead access in not required by the kernel to execute it.
$  ## Determine the current user, group, and supplementary groups
$ id
uid=1001(terry) gid=100(users) groups=100(users),600(ftpaccess),601(terry),1001(mktg),1002(acctg),1004(family)

$ ## Determine the file type of /usr/bin/ls
$ file /usr/bin/ls  
/usr/bin/ls: executable, regular file, no read permission

$ ## Show the permissions, owner, group of /usr/bin/ls 
$ ls -l /usr/bin/ls
-r-x--x--x 1 root root 110272 Mar 17  2014 /usr/bin/ls

$ ##  Try to run the ls command as user terry, group users
$ ls -l /tmp/Test
total 12
drwxr-xr-x 3 root root 4096 Aug 11  2015 a
-rw-r--r-- 1 root root 8003 Feb 22  2016 known_hosts
Note that if a file is a shell script, read permission is required, in addition to execute, because the user's shell must be able to read a script in order to run it.  This is not the case with binary executable files, where only the "x" bit needs set.
Aside:  In the case of a shell script, a script file with read, but not execute permission, can be passed to the shell as an argument to be run, eg.  "bash  script.sh"
See "Execute Permission of a file" at http://www.grymoire.com/Unix/Permissions.html#TOC

SOURCE

http://www.grymoire.com/Unix/Permissions.html#TOC
Share:

Tuesday, May 7, 2019

Ext4 has the Max file size of ?

Ext4 has the Max file size of ?

  • 16 TiB (for 16k block filesystem)
  • 16 TiB (for 8k block filesystem)
  • 16 TiB (for 4k block filesystem)
  • 16 TiB (for 28k block filesystem) 

 
Ext4 has the Max file size of ?

EXPLANATION

The ext4 filesystem can support volumes with sizes up to 1 exbibyte (EiB) and files with sizes up to 16 tebibytes (TiB).[12] However, Red Hat recommends using XFS instead of ext4 for volumes larger than 100 TB.[13][14]

SOURCE

https://en.wikipedia.org/wiki/Ext4
Share:

Friday, March 15, 2019

drwxr-xr-x 3 root root 73728 Dec 26 08:39 /usr/bin/ <=== This directory file on an ext4 filesystem is listed in long format (ls -ld). The value of the fifth field, 73728, reports the size of what?

drwxr-xr-x 3 root root 73728 Dec 26 08:39 /usr/bin/ <=== This directory file on an ext4 filesystem is listed in long format (ls -ld). The value of the fifth field, 73728, reports the size of what?

  • The exact size of the directory file, in bytes.
  • The disk usage, in blocks, of the directory and all of its subdirectories.
  • The size in bytes of the total blocks in use by the directory file. [ (bytes/block) * blocks ]
  • The disk usage, in blocks, of the top level of the directory. 

 
drwxr-xr-x 3 root root 73728 Dec 26 08:39 /usr/bin/ <=== This directory file on an ext4 filesystem is listed in long format (ls -ld). The value of the fifth field, 73728, reports the size of what?

EXPLANATION

A directory file contains a list of names and corresponding inodes. 
A newly created directory file on an ext4 filesystem will have only 2 entries, dot "." and dot dot ".."  
The size of the new directory file will be 4096 bytes.  As additional entries are made to the directory, the reported size will remain at 4096 until additional bytes are required for the next directory entry.  At that point, additional blocks will be allocated to the directory and the reported directory file size will increase.
As directory entries are removed, the blocks already allocated to the directory file do not decrease, but allocated blocks are freed for future use by new entries in the directory.
https://unix.stackexchange.com/questions/234065/why-size-reporting-for-directories-is-different-than-other-files#
https://superuser.com/questions/142893/why-is-the-size-of-a-directory-always-4096-bytes-in-unix/1428...
http://www.linfo.org/directory.html
Note that when the same "ls" command is used on a regular file, the size field will report the actual file size in bytes, which is stored in the inode.  The " -s " option to "ls" will report allocated blocks, in addition to actual file size.

SOURCE

https://superuser.com/questions/142893/why-is-the-size-of-a-directory-always-4096-bytes-in-unix/142895
Share:

Wednesday, March 13, 2019

Linux and Unix systems typically track 3 timestamps in file inodes: atime, ctime, and mtime. The "a" in atime means access. The "m" in mtime means modify. What does the "c" in ctime mean?

Linux and Unix systems typically track 3 timestamps in file inodes: atime, ctime, and mtime. The "a" in atime means access. The "m" in mtime means modify. What does the "c" in ctime mean?

  • cache
  • create
  •  change
  • copy-on-write 

 
Linux and Unix systems typically track 3 timestamps in file inodes: atime, ctime, and mtime. The "a" in atime means access. The "m" in mtime means modify. What does the "c" in ctime mean?

EXPLANATION

"c" in ctime means change.  Specifically, a change to the inode's status, eg, permissions, ownership, link count, file size, etc.
http://man7.org/linux/man-pages/man7/inode.7.html
"Last status change timestamp (ctime) stat.st_ctime; statx.stx_ctime"

http://www.linux-mag.com/id/8658/
"Timestamps telling when the inode itself was last change (ctime, changing time), the file content was last modified (mtime or modification time), and when the file was last accessed (atime or access time)"

SOURCE

http://man7.org/linux/man-pages/man7/inode.7.html
Share:

Monday, March 11, 2019

What is the fastest back-end database for OpenLDAP ?

What is the fastest back-end database for OpenLDAP ?

  • hdb
  • sql
  • mdb
  • bdb 

 

EXPLANATION

  • A file with the MDB file extension is a Microsoft Access Database file that literally stands for Microsoft Database. ...
  • MDB files contain database queries, tables, and more that can be used to link to and store data from other files, like XML and HTML, and applications, like Excel and SharePoint.

 

http://www.openldap.org/pub/hyc/mdm-paper.pdf

SOURCE

http://www.openldap.org/pub/hyc/mdm-paper.pdf
Share:

Tuesday, November 6, 2018

What is cgroups in modern Linux kernels?

What is cgroups in modern Linux kernels?

  • A set of tools for paravirtualization
  • A feature that isolates and limits resource usage of processes
  • A friendly IPtables manager written in C
  • A collection of tools that prevents malware using mandatory access controls policies 

 
What is cgroups in modern Linux kernels?

EXPLANATION

Cgroups (abbreviated from control groups) is a Linux kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes.
If you are using Docker give it a try! This may be useful for hungry Java apps ;)
See more at Wikipedia and kernel.org


Share:

Thursday, September 6, 2018

Which of the following is NOT a Linux distro?

Which of the following is NOT a Linux distro?

  • BSD
  • Ubuntu
  • Mint
  • Red Hat 

Which of the following is NOT a Linux distro?

EXPLANATION

Berkeley Software Distribution (BSD) is a Unix operating system derivative developed and distributed by the Computer Systems Research Group 
(CSRG) of the University of California, Berkeley, from 1977 to 1995. Today the term "BSD" is often used non-specifically to refer to any of the BSD descendants which together form a branch of the family ofUnix-like operating systems. Operating systems derived from the original BSD code remain actively developed and widely used.
Share:

Monday, August 27, 2018

Which of these is not a high level Linux package manager?

Which of these is not a high level Linux package manager?

  • aptitude
  • yum
  • zypper
  • linupdate

Which of these is not a high level Linux package manager?

EXPLANATION

linupdate is the false one here. The others are all legitimate Linux package managers. Even though these are package managers, they use lower level tools to actually install the packages, such as rpm or dpkg.
Overview: http://www.tecmint.com/linux-package-management/
RPM & DPKG reference: http://packman.linux.is/
 
Share:

Friday, August 10, 2018

In Linux system, which command will print the output of log file in reverse ?

In Linux system, which command will print the output of log file in reverse ?

  • less
  • cat
  • tac
  • rcs 

 
In Linux system, which command will print the output of log file in reverse ?

EXPLANATION

Let's assume that we have a log file named "Letters" that contains: A B C D (in separate lines).
To view the content of the log file in Linux terminal, the command will be:
linux@machine:~$ sudo cat Letters
And we will get the output:
A
B
C
D

To view the content of the log file in reverse, the command will be:
linux@machine:~$ sudo tac Letters
And we will get the output:
D
C
B
A




SOURCE

https://www.tecmint.com/learn-linux-cat-command-and-tac-command/
Share:

Tuesday, July 31, 2018

In Unix, which of the following commands could you use to find files with a .log extension in the /var directory?

In Unix, which of the following commands could you use to find files with a .log extension in the /var directory?

  • find /var -name "*.log"
  • mv "*.log"
  • ls -l *.log
  • find / | grep "*.log" 

 

EXPLANATION

The "find" command specifies the directory, "/var". The "-name" option tells the "find" command to show only files that have a ".log" extension.

SOURCE

https://quiz.techlanda.com/2017/11/in-unix-which-of-following-commands.html
Share:

Wednesday, July 11, 2018

In Linux, what's the difference between a hard link and a symbolic link?

In Linux, what's the difference between a hard link and a symbolic link?

  • A hard link does not depend on software libraries, a soft link does.
  • A hard link persists across OS reboots, a symbolic link does not.
  • Normal users can use only symbolic links, only the "root" user can use hard links.
  • A hard link points to a file's inode, a symbolic link is a pointer to the file. 

In Linux, what's the difference between a hard link and a symbolic link?

EXPLANATION

Symbolic links are much more common than hard links. They are aliases to an already existing file, and deleting the symbolic link will leave the existing file intact.
Renaming the file will break the link.  Hard links point to the very same filesystem inode used by the target file, so renaming the target file will have no effect on the hard link-- it will still point to the original file.  If for some reason the file targeted by a hard link is moved to a different spot in the filesystem, the hard link will no longer be valid.  Symbolic links are much more common than hard links.
Share:

Monday, July 9, 2018

To avoid data corruption, which of the following should you do before performing fsck on a file system?

To avoid data corruption, which of the following should you do before performing fsck on a file system?

  • Reboot the machine
  • Create a new data partition
  • Unmount the file system
  • Ensure the file system is mounted 

 
To avoid data corruption, which of the following should you do before performing fsck on a file system?

EXPLANATION

The fsck command is used to check and repair one or more Linux file systems. Running fsck on a mounted file system can cause data or disk corruption. Instead, you can do one of the following:
(a) Take down system to single user mode and unmount the system
(b) Boot from the installation CD

Share:

Wednesday, May 30, 2018

Which of the following commands could you use to exit the vi Editor in Linux, saving changes?

Which of the following commands could you use to exit the vi Editor in Linux, saving changes?

  • :q
  • :q!
  • :x
  • Ctrl + Z 

Which of the following commands could you use to exit the vi Editor in Linux, saving changes?

 EXPLANATION



:x - Exit, saving changes
:q - Exit as long as there have been no changes

:q! - Exit and ignore any changes
Ctrl + Z - Suspend editor
https://www.cs.colostate.edu/helpdocs/vi.html
http://www.lagmonster.org/docs/vi.html
http://www.rollanet.org/~mdoc/vi.htm
Share:

Monday, May 21, 2018

What type of RAID is RAID-Z?

What type of RAID is RAID-Z?

  • Hardware RAID
  • Software RAID
  • not a RAID
  • Virtual RAID 

 
What type of RAID is RAID-Z?

EXPLANATION

RAID-Z is a software raid achieved by

data/parity distribution scheme like RAID-5, but uses dynamic stripe width: every block is its own RAID stripe. It is primarily used by ZFS file system.
https://en.wikipedia.org/wiki/ZFS#RAID-Z


SOURCE

https://en.wikipedia.org/wiki/ZFS#RAID-Z
Share:

Thursday, May 3, 2018

In a Unix environment, what is a daemon?

In a Unix environment, what is a daemon?

  • A multicore processor type for Linux OS
  • A type of virus or malware
  • A different user interface or desktop
  • A program that runs as a background process

 
In a Unix environment, what is a daemon?

EXPLANATION

Wikipedia entry: A daemon is a computer program that runs as a background process,
rather than being under the direct control of an interactive user.
Share:

Friday, April 13, 2018

In Linux and Unix systems, what directory is most likely to contain system configuration data?

In Linux and Unix systems, what directory is most likely to contain system configuration data?

  • /boot/
  • ~/.config
  • /usr/share/doc
  • /etc/ 
 
In Linux and Unix systems, what directory is most likely to contain system configuration data?

EXPLANATION

As a rule, system configuration data should be kept in /etc/ http://tldp.org/LDP/Linux-Filesystem-Hierarchy/Linux-Filesystem-Hierarchy.pdf This can be quite useful knowledge when figuring out backup and recovery plans!
 
Share:

Thursday, April 5, 2018

What does a bcache in Linux do?

What does a bcache in Linux do?

  • "B" stands for binary coding, the bcache is an prior chaching method.
  • Bcache is a advanced technology to encrypt your cache as an addition to full disc encryption.
  • Bcache has nothing to do with Linux.
  • Allows faster storage devices to act as caching devices for slower storage devices. 


EXPLANATION

Bcache allows one to use an SSD as a read/write cache (in writeback mode) or read cache (writethrough or writearound) for another blockdevice (generally a rotating HDD or array). For an intro to bcache itself, see the bcache homepage.

Share:

Monday, March 26, 2018

What Linux command sets a files permission?

What Linux command sets a files permission?

  • properties
  • rights
  • chmod
  • attrib 
What Linux command sets a files permission?

EXPLANATION


In order to make this practical, a method had to be devised to protect the users from each other. After all, you could not allow the actions of one user to crash the computer, nor could you allow one user to interfere with the files belonging to another user.
This lesson will cover the following commands:
chmod - modify file access rightssu - temporarily become the superuserchown - change file ownershipchgrp - change a file's group ownership

SOURCE

http://linuxcommand.org/lc3_lts0090.php
Share:

Tuesday, March 20, 2018

Which of these is NOT a utility that lets you create a bootable live USB drive for Linux?

Which of these is NOT a utility that lets you create a bootable live USB drive for Linux?

  • LiveUSB Install
  • UNetbootin
  • GotLive
  • LiLi 
Which of these is NOT a utility that lets you create a bootable live USB drive for Linux?

EXPLANATION

LinuxLive USB Creator (also known as Lili) is a free and open-source software for Windows that can be used to install various Linux compilations, versions and distributions to a USB Flash Drive. The end result is a Bootable Live USB (in some cases with Persistence as well). UNetbootin allows you to create bootable Live USB drives for Ubuntu and other Linux distributions without burning a CD.

Share:

Popular Posts