Sunday 5 July 2020

What is the difference between Linux and Unix?

76. What is the difference between Linux and Unix?

Linux Unix

Both paid and free distributions are available. Different paid structures for different levels of Unix.

Linux primarily uses GUI with an optional            Unix uses the command-line interface
command-line interface

Portable and can be executed in                        Not portable.
different hard drives

Developed by a worldwide Linux community. Developed by AT&T developers.

Bug Fix Speed is Faster because            Bug Fix Speed is Slow
Linux is Community driven.

Linux is used at home-based PC's, phones, etc. Unix is used mainly as Internet Server, Workstations, Mainframes.

File System Support: Ext2, Ext3, Ext4,     File System Support: jfs, gpfs, hfs, hfs+, 
Jfs, ReiserFS, Xfs, Btrfs, FAT, FAT32, NTFS.           ufs, xfs, zfs,vxfs.

Examples:Ubuntu, Fedora, Red Hat, Examples:OS X, Solaris, All Linux
Kali Linux, Debian, Archlinux, Android, etc. 

Linux comes with open source Netfilter and   UNIX operating systems comes with its own firewall 
IPTables based firewall tool to protect server         products. 
and desktop from the crackers and hackers. 

Viruses listed: 60-100 Viruses listed: 80-120

77. What are soft links? Describe some of the features of soft links?

Soft Links or Symbolic Link or Symlink are special files which are used as a reference for another directory.

 Some features of softlinks are:

They have a different INODE number with respect to source files or original files.
If in case the original file is deleted then a soft link of that file is useless.
We cannot update a soft link.
Soft links are used to create links between directories.
Soft links are independent of file system boundaries.
78. Explain the linux directory commands?

The linux directory commands are :

pwd: It is a built-in command which stands for ‘print working directory’. It displays the current working location, working path starting with a / and directory of the user. Basically, it displays the full path to the directory you are currently in.

Is: This command lists out all the files in the directed folder.

cd: This stands for ‘change directory’. This command is used to change to the directory you want to work from the present directory. 

mkdir: This command is used to create an entirely new directory.

rmdir: This command is used to remove a directory from the system.
79. Which is the first process started by the kernel and what is itsprocess id?

‘init’ is the first process in linux which is started by the kernel and its process id is 1.
80. Is it legal to edit Linux Kernel?

Yes , it is absolutely legal to edit Linux Kernel. Kernel is released under General Public License(GPL) , and anyone can edit Linux Kernel to the extent permitted under GPL. Linux Kernel comes under the category of Free and Open Source Software(FOSS).
81. Explain /bin, /usr, /sbin, /user/bin and /user/sbin Linux directories?

/bin: Its critical directory used to bring the system online in single-user mode to repair it. This contains executable programs(can say scripts) for this.

/sbin: This directory holds commands needed to boot the system in normal condition but not executed or used by normal users.

/usr: This is one of the largest directories in the Linux system, mostly mounted from a separate partition. Birnies and files all programs are installed reside here.

/usr/bin: This directory contains programs, executables and scripts not used for boot process but used by users to execute. Most of the programs or executable executed by users rather than root

/usr/sbin: Program binaries or executables required for a system administrator is kept under this directory. This program binaries or executables are not required for boot process or normal users.

82. What are filenames that are preceded by a dot?

Generally, all the hidden files are preceded by a dot. These files hold important or setup info as they can be configuration files. Keeping these files as hidden makes them secure from being accidentally deleted.

83. What does Sar provide? Where are Sar logs stored?
SAR is an abbreviation for System Activity Report. This command is used to collect data, report and save the usage of CPU, a Memory unit, input, and output in Linux. 

84. What is the full form of grep?

Grep stands for global regulation expression point. The command-line utility, grep, is used for searching data sets in plain-text for lines that match an expression which is used regularly. 

85. Explain Window Manager in Linux?

Window Manager is client software that controls icons, placement of icons, the appearance of the window after login to the system. This is desktop management software. LINUX is an open-source operating system and it have a long list of WM software available in the market. The system administrator can install and configure it as per user or environment requirements. One thing before using WM software, they will consume additional resources on the system.

The/etc/.xinitrc file is hidden system files allows you to change the window manager while login from any or particular user account. The prefix of “.” In the file, the name shows that it is hidden file and you will not be able to view it with the normal ls command.  WM gives enhance user experience or add-on features.

Some of the popular command for WM or desktop management are:-

The KDE = startkde
The Gnome = gnome-session
The Blackbox = Blackbox
The FVWM = fvwm
The Window Maker = wmaker
The IceWM = icewm

86. What is the FTP Server?

FTP is the simplest file transfer protocol to exchange files to and from a remote computer or network system. Similar to Windows, Linux, and UNIX operating systems they also have built-in command-line prompts that can be used as FTP clients to establish FTP connection. FTP works in Client-Server architecture to communicate and transfer the file during an established FTP session. 

When the Client initiates a connection to the server, it’s called Passive Connection. Whereas when Server initiates a connection to the client, it’s called Active Connection.

In Phase 1, When Connection initiated with the server, User credentials are passed for authentication. This is the control connection phase. In Phase 2, When actual data is transferred between client & server, This is data connection phase.

87. Differences between Softlink and Hardlink?

Hard Links 

  •   Gets created using same I-node number with a different name.
  •   Can only be created within same file system.
  •   Remains even if original file is removed.
  •   Can’t be created for directories.
  •   Created using ln command

Soft Links

  •   Gets created using alias name referring the original file name, but uses different I-node.
  •   Can be created across file systems.
  •   Dies after original file is removed, otherwise exists as a dead link.
  •   Can be used to create links to directories.
  •   Created using ln -s command

88. What is the difference between umask and ulimit?

unmask stands for user file creation mode. When the user creates any file, it has default file permissions. So unmask will specify few restrictions to the newly created file (it controls the file permissions).

umask [-S] [mask]

You can limit user to specific range by editing /etc/security/limits.conf at the same time system wide settings can be updated in /etc/sysctl.conf

89. Your server is using a lot of cached memory. How do you free it up short of rebooting?

Kernels 2.6.16 and newer provide a mechanism to have the kernel drop the page cache and/or inode and dentry caches on command, which can help free up a lot of memory.
To free page cache, dentries and inodes: echo 3 > /proc/sys/vm/drop_caches

90. What is the difference between /dev/random and /dev/urandom for generating random data?

The Random Number Generator gathers noise of environment from the device drivers and other sources into the entropy pool. It also keeps an estimate of the number of bits of the noise in an entropy pool. It is from this entropy pool and will generate random numbers.

/dev/random will only be returning Random bytes from the entropy pool. If the entropy pool is empty, reads to /dev/random will be blocked until the additional environmental noise will be gathered. This is suited to high-quality randomnesses, such as the one-time pad or key generation.

/dev/urandom will return as many random bytes requested. But if the entropy pool is empty, this will generate data using SHA, MD5 or any other available algorithm. It never blocks the operations. Due to which, the values are vulnerable to the theoretical cryptographic attack, though no known methods will exist.

For cryptographic purposes, we should really use the /dev/random because of the nature of data it returns. Possible waiting should be considered as an acceptable tradeoff for the sake of the security, IMO. When we need random data fast, we should use the /dev/urandom of course.

Both /dev/urandom and the /dev/random are using exact same CSPRNG (a cryptographically secure pseudorandom number generator). They can only differ in very few ways that have nothing to do with the “true” randomness and then /dev/urandom is the preferred source of cryptographic randomness on the UNIX-like systems.

91. What is Samba Share?

Samba is an open-source software suite that runs on the Unix/Linux based platforms but it is able to communicate with the Windows clients like a native application. So Samba is able to provide the service by employing the Common Internet File System (CIFS).

At the heart of the CIFS is the Server Message Block (SMB) protocol.  Samba does this by performing the four key things –

The File & print services
The Authentication and Authorization
The Name resolution
The Service announcement (browsing)

Samba can be run on many different platforms including Linux, Unix, OpenVMS and the operating systems other than the Windows and allows users to interact with a Windows client or server natively. It can basically be described as Standard Windows interoperability suite of the programs for Linux and Unix.

92. What is IRIX Mode in top command?

In Irix Mode, System considers all processors as a whole and CPU usage can vary from 0 to 100 only. IRIX feature was introduced in Solaris and adopted by Linux later.

93. If you have a file with 2000 IP's. How do you ping them all using bash in parallel?

# echo $(cat iplistfile) | xargs -n 1 -P0 ping -w 1 -c 1

94. What command can you use to send unsolicited ARP updates to the neighboring servers caches.

# arping -U -c 1 -I eth0 -s IP_ADDRESS

95. Write command to list all the links from a directory?

# ls -lrt | grep "^l"

96. What Linux utility can craft custom packets, like TCP SYN packets and send them to a remote host?

# hping3 -S -p 80 -i u1

97. Create a read-only file in your home directory?

create a file and change its parameter to read-only by using chmod command you can also change your umask to create read only file.

$ touch file
$ chmod 400 file

98. How will you run a process in background? How will you bring that into foreground and how will you kill that process?

For running a process in background use "&" in command line. For bringing it back in foreground use command "fg jobid" and for getting job id you use command jobs, for killing that process find PID and use kill -9 PID command.

99. How to search files in linux?

To search files in Linux, use the locate  or find command.

100. How to remote login to another linux computer?

You can log in to a remote Linux computer using SSH protocol or using the VNC service.

                                                                                           MENU         PREVIOUS | NEXT

No comments:

Post a Comment