IT Questions and Answers :)

Tuesday, March 20, 2018

By default, which of the following is NOT a legitimate Linux run level?

By default, which of the following is NOT a legitimate Linux run level?

  • 4: Normal mode
  • 6: Reboot system
  • 1: Single-user mode
  • 3: Multi-user mode with networking 
By default, which of the following is NOT a legitimate Linux run level?

EXPLANATION

A Linux run level defines the state of the system after boot. Conventionally, seven run levels exist, numbered from zero to six. They include:
0: Halt system
1: Single-user mode
2: Basic multi-user mode without NFS
3: Multi-user mode with networking
4: Unused
5: Multi-user mode with GUI

6: Reboot system

SOURCE


Share:

Which of these is NOT a real Linux package manager?

Which of these is NOT a real Linux package manager?

  • PETget
  • Tuxbrew
  • Conary
  • Pacman 

Which of these is NOT a real Linux package manager?

EXPLANATION


Linux package managers are a dime a dozen and have lots of crazy names, like Pacman, PETget, and Conary.
Share:

Tuesday, February 13, 2018

Unix time is the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC) on what date?

Unix time is the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC) on what date?

  • Saturday, January 1, 2000
  • Sunday, December 28, 1969
  • Thursday, January 1, 1970
  • Monday, January 1, 1900 

 
Unix time is the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC) on what date?

EXPLANATION

Unix time counts the number of seconds that have elapsed since 00:00:00 UTC on January 1, 1970. It is used in Unix-like operating systems and file formats. Because it doesn't deal with leap seconds, it is not a true representation of UTC. Check out Unix time for yourself by typing "date +%s" on the command line.

Fun fact: December 28, 1969, is Linus Torvalds' birthday, which makes him older than Unix.

Share:

Wednesday, January 24, 2018

Ubuntu releases are usually nicknamed after animals. Which of these was not a release nickname?

Ubuntu releases are usually nicknamed after animals. Which of these was not a release nickname?

  • Avid Aardvark
  • Hoary Hedgehog
  • Jaunty Jackalope
  • Warty Warthog 

 
Ubuntu releases are usually nicknamed after animals. Which of these was not a release nickname?

EXPLANATION

The only one of these ridiculous names that isn't a real thing is Avid Aardvark.

Share:

Thursday, January 4, 2018

Which of these is NOT a real Linux package manager?

Which of these is NOT a real Linux package manager?

  • Tuxbrew
  • PETget
  • Pacman
  • Conary 
Which of these is NOT a real Linux package manager?

 

EXPLANATION

Linux package managers are a dime a dozen and have lots of crazy names, like Pacman, PETget, and Conary.

Share:

Friday, December 22, 2017

Which one of these is not Linux terminal based text editor?

Which one of these is not Linux terminal based text editor?

  • Nano
  • Vi
  • AkelPad
  • Pico 
Which one of these is not Linux terminal based text editor?

 

EXPLANATION


Vi - is first linux editor, it is in every distribution and it is general command line editor.
Nano/Pico - are from same core text editors in Linux and they are second most used editor.
AkelPad is windows based text editor
References:https://en.wikipedia.org/wiki/AkelPad
http://www.linux.org/threads/text-editors.4104/
Share:

In Unix what program notifies the user of a new mail notification by sending an alert to the tty?

In Unix what program notifies the user of a new mail notification by sending an alert to the tty?

  • biff
  • squib
  • gnub
  • ding 

 
  In Unix what program notifies the user of a new mail notification by sending an alert to the tty?

EXPLANATION


When a new mail message is delivered, the program biff alerts the recipient so they can read it immediately. The alert is sent to the tty where the recipient is logged in, and contains the Subject, From line, and first few lines of the body of the new message. The alert also includes terminal beeps to guarantee quick attention.
Notification is enabled by the command
biff yand disabled by
biff n
https://en.wikipedia.org/wiki/Biff
Share:

Thursday, December 21, 2017

drw-r-x-wx 2 terry staff 4096 Mar 10 14:29 Secret <== Based on permissions assigned to user (terry), group (staff), and other, which non-root users have permission to remove files in directory "Secret?"

drw-r-x-wx 2 terry staff 4096 Mar 10 14:29 Secret <== Based on permissions assigned to user (terry), group (staff), and other, which non-root users have permission to remove files in directory "Secret?"

  • Both owner "terry" and group "staff" members
  • Any user in "other"
  • The owner, user "terry"
  • Any member of group "staff" 
drw-r-x-wx 2 terry staff 4096 Mar 10 14:29 Secret <== Based on permissions assigned to user (terry), group (staff), and other, which non-root users have permission to remove files in directory "Secret?"

EXPLANATION

To remove a file, a user needs write and access (execute) permission on the directory. That is, -wx at minimum.
The user does not need read permission on the directory to remove a file if the name is known, but read permission on the directory would be required to discover the filename, for example, with "ls".
User "terry", the owner, does not have access to the directory (x is absent for user).

SOURCE

https://www.hackinglinuxexposed.com/articles/20030424.html
Share:

Tuesday, December 5, 2017

By default, which of the following is NOT a legitimate Linux run level?

By default, which of the following is NOT a legitimate Linux run level?

  • 6: Reboot system
  • 1: Single-user mode
  • 4: Normal mode
  • 3: Multi-user mode with networking 

By default, which of the following is NOT a legitimate Linux run level?

EXPLANATION

A Linux run level defines the state of the system after boot. Conventionally, seven run levels exist, numbered from zero to six. They include:
0: Halt system
1: Single-user mode
2: Basic multi-user mode without NFS
3: Multi-user mode with networking
4: Unused
5: Multi-user mode with GUI

6: Reboot system

Share:

Friday, December 1, 2017

What is the first program that the Linux kernel runs once it's booted in a normal boot process?

What is the first program that the Linux kernel runs once it's booted in a normal boot process?


  • init
  • dmesg
  • lilo
  • rc             
What is the first program that the Linux kernel runs once it's booted in a normal boot process?

EXPLANATION

The Linux kernel runs init as the first program; init then runs, via various scripts, other programs. The dmesg program is a user diagnostic and information tool not part of startup. The rc program is a script that some versions of init call during startup sequence but its not the first program the kernel runs. The lilo command installs the boot loader to MBR. The boot loader runs before the
Share:

Thursday, November 23, 2017

If you’re looking to display all files in a given directory and all its sub-directories, including hidden files, which of the following Linux command would you use?

If you’re looking to display all files in a given directory and all its sub-directories, including hidden files, which of the following Linux command would you use?

  • ls -aR
  • ls -l
  • ls-a
  • ls -R 

 
If you’re looking to display all files in a given directory and all its sub-directories, including hidden files, which of the following Linux command would you use?

EXPLANATION

The Bash command "ls" lists all information about a given file. In this case, it’s modified by "-aR" to maintain groups of files as a single archive file, which displays everything in a given file. By itself, this command will show you everything on your hard disk (and we mean everything).

SOURCE

http://linuxcommand.org/lc3_man_pages/ls1.html
Share:

In Linux, what does the -a flag stand for, when used with the rsync command?

In Linux, what does the -a flag stand for, when used with the rsync command?

  • Archive
  • Active
  • Append
  • Advanced 

 
In Linux, what does the -a flag stand for, when used with the rsync command?

EXPLANATION

From the man page: 
 -a, --archive archive mode; same as -rlptgoD (no -H)

http://linuxcommand.org/man_pages/rsync1.html
Share:

Using VIM, what is the find\replace function for replacing the word 'hot' with 'cold' in an entire document?

Using VIM, what is the find\replace function for replacing the word 'hot' with 'cold' in an entire document?

  • :s/hot/cold/g
  • :%s/hot/cold/g
  • :qw! hot\cold
  • :w!/hot/cold%s 
Using VIM, what is the find\replace function for replacing the word 'hot' with 'cold' in an entire document?

 EXPLANATION

Vim provides the :s (substitute) command for search and replace.  The :substitute command searches for a text pattern, and replaces it with a text string. There are many options, but these are what you probably want:
:%s/foo/bar/g
Find each occurrence of 'foo' (in all lines), and replace it with 'bar'.
:s/foo/bar/g
Find each occurrence of 'foo' (in the current line only), and replace it with 'bar'.
:%s/foo/bar/gc
Change each 'foo' to 'bar', but ask for confirmation first.
:%s/\<foo\>/bar/gc
Change only whole words exactly matching 'foo' to 'bar'; ask for confirmation.

SOURCE

http://vim.wikia.com/wiki/Search_and_replace
Share:

Which of the following is NOT a Linux distro?

Which of the following is NOT a Linux distro?

  • Ubuntu
  • Red Hat
  • Mint
  • BSD
 
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:

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 / | grep "*.log"
  • find /var -name "*.log"
  • ls -l *.log
  • mv "*.log" 

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

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://www.lifewire.com/uses-of-linux-command-find-2201100
Share:

In Linux systems with iproute2, which command will list all routes?

In Linux systems with iproute2, which command will list all routes?

  • ip route show
  • route print
  • show ip route
  • route 

 
In Linux systems with iproute2, which command will list all routes?

EXPLANATION

In Linux systems equipped with iproute2, the command "ip route show" will display the current routing table.
In older Linux systems, the shorter command "route" was available through the net-tools package; this package is now deprecated in favor of iproute2.
"show ip route" is the command to show the routing table in Cisco's IOS.
"route print" will show the routing table in Windows.

Share:

Wednesday, November 22, 2017

In Arch Linux, which command can you use to completely empty the package cache?

In Arch Linux, which command can you use to completely empty the package cache?

  • apt-get clean
  • pacman -Syyu
  • apt-clear -Syu
  • pacman -Scc 
 
In Arch Linux, which command can you use to completely empty the package cache?

EXPLANATION

The pacman command stores its downloaded packages in /var/cache/pacman/pkg/ and does not remove the old or uninstalled versions automatically, therefore it is necessary to deliberately clean up that folder periodically to prevent such folder to grow indefinitely in size. The built-in option to remove all the cached packages that are not currently installed and also prevents from reinstalling a package directly from the cache folder in case of need, thus requiring a new download is the following:

# pacman -Scc

SOURCE

https://wiki.archlinux.org/index.php/pacman
Share:

Which Linux file access mode below corresponds to the numeric mode 750?

Which Linux file access mode below corresponds to the numeric mode 750?

  • rwxrwxrwx
  • rw-r--r--
  • rwxr-x---
  • r-xr----- 

Which Linux file access mode below corresponds to the numeric mode 750?

EXPLANATION

Each octal digit corresponds to the three bits for that access type, in order. The read, write, and execute bits are the 4, 2, and 1 bit respectively.
The first digit (7) is for the file owner ("user"), and is the sum of all three bits: read (4) + write (2) + execute (1).
The second digit (5) for the owning group is read (4) + execute (1).
The final digit is zero, meaning no access for "other" users.
Wikipedia page on Unix file modesOnline permission calculator
Share:

A directory entry on a Unix or Linux system includes which of the following?

A directory entry on a Unix or Linux system includes which of the following?

  • inode number, filename, symlink names, and mode settings
  • filename and inode number
  • inode number, filename, mode settings, and file size in block count
  • inode number, all hardlinked filenames, mode settings, and ownership (UID and GID) 

A directory entry on a Unix or Linux system includes which of the following?

EXPLANATION

From the readdir man page on Linux:

       On Linux, the dirent structure is defined as follows:

           struct dirent {
               ino_t          d_ino;       /* inode number */
               off_t          d_off;       /* not an offset; see NOTES */
               unsigned short d_reclen;    /* length of this record */
               unsigned char  d_type;      /* type of file; not supported
                                              by all file system types */
               char           d_name[256]; /* filename */
           };



       The  only  fields  in the dirent structure that are mandated by POSIX.1 are: d_name[], of unspecified size, with at
       most NAME_MAX characters preceding the terminating null byte ('\0'); and (as an XSI extension)  d_ino.   The  other
       fields are unstandardized, and not present on all systems; see NOTES below for some further details.

From:
https://en.wikipedia.org/wiki/Unix_File_System
"Directory files contain only the list of filenames in the directory and the inode associated with each file."

SOURCE

https://linux.die.net/man/3/readdir
Share:

What is the package manager for Arch Linux?

What is the package manager for Arch Linux?

  • pacman
  • pkgtool
  • apk
  • pkgcon 

 
What is the package manager for Arch Linux?

EXPLANATION

Arch Linux's Pacman has been around for a long time and it's often considered one of the fastest package management utilities around.

Share:

Popular Posts