Cloud Network

Networking | Support | Tricks | Troubleshoot | Tips

Buymecoffe

Buy Me A Coffee

Monday, October 14, 2019

Basic Linux Interview Question and Answer

October 14, 2019
Basic Linux Interview Question and Answer





 Q : –  Please describe the Linux boot-up sequence ?
Ans :-
There are seven steps to the boot-up sequence.
1) BIOS (basic input/output system) – executes the MBR where Bootloader sits.
 2) MBR- Master boot reads Kernel into memory.
 3) GRUB (Grand Unified Bootloader) Kernel starts Init process.
 4) Kernel – Kernel executes the /sbin/init program.  Init reads inittab, executes rc.sysinit.
5) Init – the rc script then starts services to reach the default runlevel &
6) Run level programs – these programs are executed from /etc/rc.d/rc*.dl/

Q : –  Linux is which kind of Operating System ?
Ans :-
Multi User
Multi Tasking
Multi Process
All of the above
Linux is an Operating System which supports Multi User, Running a Number of Processes performing different tasks simultaneously.

Q : –  Is Linux Operating system Virus free?
Ans :- No! There doesn’t exist any Operating System on this earth that is virus free. However Linux is known to have least number of Viruses, till date, yes even less than UNIX OS. Linux has had about 60-100 viruses listed till date. None of them actively spreading nowadays. A rough estimate of UNIX viruses is between 85 -120 viruses reported till date.

Q : –  What are the Monitoring Tools used in Linux ?
Ans :-
1 top - Process Activity Command
2 ps - Displays The Processes
3 iostat - Average CPU Load, Disk Activity
4 vmstat - System Activity, Hardware and System Information

These are main monitoring tools ,"Nagios" is also we can use
this is third party open source application software
w for connected user
last for login & reboot history
lastb- for fail login attempts
lastlog- for most recent login

Q : – You are supposed to calculate a real number calculation directly from terminal and not any shell script. What will you do (say the real numbers are 7.56 and 2.453) ?
Ans :-
We need to use bc command in a special way as described below. The output of echo 7.56 + 2.453 should be pipelined to bc.
For example, run the following command to calculate numbers in real time using bc command as shown.
$ echo 7.56 + 2.453 | bc
10.013

Q : – Give me some commands for user management.
Ans :- last, change, chsh, lsof, chown, chmod, useradd, userdel, newusers.

Q : – Give me some security monitoring related commands.
Ans :- lsof, netstat, top, ps -ef, tail, last, tcpdump, sestatus, history, w.

Q : – What is the difference between man, info, whatis commands and a –help option for a command?
Ans :- man command gives you medium size info.
info command gives full details about a commands, lots and lots of information about a command.
–help option for a command gives you one line answers for each option supported by a command

Q: – Every command in Linux is a ?
Ans:- Executable program



Q: – What is GRUB
Ans:- GNU GRUB is a Multiboot boot loader. It was derived from GRUB, the GRand Unified Bootloader.
which was originally designed and implemented by Erich Stefan Boleyn.
Briefly, a boot loader is the first software program that runs when a computer starts.
It is responsible for loading and transferring control to the operating system kernel software (such as the Hurd or Linux).
The kernel, in turn, initializes the rest of the operating system (e.g. GNU)

Q: – Explain Linux Boot Process ?
Ans:- Press the power button on your system, and after few moments you see the Linux login prompt.
Have you ever wondered what happens behind the scenes from the time you press the power button until the Linux login
prompt appears?
The following are the 6 high level stages of
a typical Linux boot process.






BIOS :- BIOS stands for Basic Input/Output System
Performs some system integrity checks
Searches, loads, and executes the boot loader program.
It looks for boot loader in floppy, cd-rom, or hard drive. You can press a key (typically F12 of F2, but it depends on your system) during the BIOS startup to change the boot sequence.
Once the boot loader program is detected and loaded into the memory, BIOS gives the control to it  and
So, in simple terms BIOS loads and executes the MBR boot loader

MBR :- MBR stands for Master Boot Record.
It is located in the 1st sector of the bootable disk.
Typically /dev/hda, or /dev/sda
MBR is less than 512 bytes in size.
This has three components
         1) primary boot loader info in 1st 446 bytes
         2) partition table info in next 64 bytes
and   3) mbr validation check in last 2 bytes.
It contains information about GRUB (or LILO in old systems). and
So, in simple terms MBR loads and executes the GRUB boot loader.

GRUB :- GRUB stands for Grand Unified Bootloader.
If you have multiple kernel images installed on your system, you can choose which one to be executed.
GRUB displays a splash screen, waits for few seconds, if you don’t enter anything, it loads the default kernel image as specified in the grub configuration file.
GRUB has the knowledge of the filesystem (the older Linux loader LILO didn’t understand filesystem).
Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). The following is sample grub.conf of CentOS.
As you notice from the above info, it contains kernel and initrd image and
So, in simple terms GRUB just loads and executes Kernel and initrd images.

KERNEL :- Mounts the root file system as specified in the “root=” in grub.conf
Kernel executes the /sbin/init program
Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
initrd stands for Initial RAM Disk.
initrd is used by kernel as temporary root file system until kernel is booted and the real root filesystem is mounted AND
 It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.

Runlevel Programs :- When the Linux system is booting up, you might see various services getting started.
For example, it might say “starting sendmail …. OK”. Those are the runlevel programs, executed from the run level directory as defined by your runlevel.
Depending on your default init level setting, the system will execute the programs from one of the following directories.

Run level 0 – /etc/rc.d/rc0.d/
Run level 1 – /etc/rc.d/rc1.d/
Run level 2 – /etc/rc.d/rc2.d/
Run level 3 – /etc/rc.d/rc3.d/
Run level 4 – /etc/rc.d/rc4.d/
Run level 5 – /etc/rc.d/rc5.d/
Run level 6 – /etc/rc.d/rc6.d/
Please note that there are also symbolic links available for these directory under /etc directly.
So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K.
Programs starts with S are used during startup. S for startup.
Programs starts with K are used during shutdown. K for kill.
There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed.
For example, S12syslog is to start the syslog daemon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of 80. So, syslog program will be started before sendmail.

INIT :- Looks at the /etc/inittab file to decide the Linux runlevel.
0 – halt
1 – Single user mode
2 – Multiuser, without NFS
3 – Full multiuser mode
4 – unused
5 – X11
6 – reboot

Init identifies the default init level from /etc/inittab and uses that to load all appropriate program.
Execute ‘grep initdefault /etc/inittab’ on your system to identify the default runlevel.
If you want to get into trouble, you can set the default run level to 0 or 6.
Since you know what 0 and 6 means, probably you might not do that AND
Typically you would set the default runlevel to either 3 or 5.


Q: –  Which files are called for user profile by default when a user gets login ?
Ans:- $HOME/.bash_profile, $HOME/.bash_bashrc

Q: –  Which file needs to update if required to change default runlevel 5 to 3 ?
Ans:- File is /etc/inittab and required to change below lines:
             id:5:initdefault: to id:3:initdefault:

Q: – What command used for showing user info like Login Name, Canonical Name, Home Directory,Shell etc..
Ans:- FINGER command can be used i.g; finger username
 command to change user password expiration time
CHANGE

Q: –  Command used to lock user password
Ans:- usermod -L username

Q: – How many default number of Shells available and what are their names?
Ans:- SH, BASH, CSH, TCSH, NOLOGIN, KSH

Q: –  Which file defines the attributes like UID, PASSWORD expiry, HOME Dir create or not while adding user
Ans:- /etc/login.defs

Q: –  Command used for changing authentication of linux system to LDAP/NIS/SMB/KERBEROS
Ans:- authconfig

Q: – Command used for changing the attributes of any file ?
Ans:- chattr

Q: – What is the path of network (ethX) configuration files ?
Ans:- /etc/sysconfig/network-scripts/ethX

Q: – How can we change speed and make full duplex settings for eth0 ?
Ans:- We can do this with below given 2 methods:
ethtool -s eth0 speed 100 duplex full
ethtool -s eth0 speed 10 duplex half
OR
mii-tool -F 100baseTx-HD
mii-tool -F 10baseT-HD

 Q: – Main configuration file and command used for exporting NFS directories and it’s demons?
Ans:- /etc/exports and exportfs -av , demons are quotad, portmapper, mountd, nfsd and nlockmgr/status

Q: – What is command to check ports running/used over local machine ?
Ans:- netstat -antp

Q: – What is the command to check open ports at remote machine ?
Ans:- nmap

Q: – Restricting insertion into file if full permission are assigned to all ?
Ans:- chattr +i filename

 Q: –  What is the difference between soft and hard links ?
Ans:-
Soft Links =>
1) Soft link files will have different inode numbers then source file.
2) If original file deleted then soft link file be of no use.
3) Soft links are not updated.
4) Can create links between directories.
5) Can cross filesystem boundaries




Hard Links =>
1) Hard links will have the same inode number as source file.
2) Hard links can not link directories.
3) Can not cross filesystem boundaries.
4) Hard links always refers to the source, even if moved or removed.

Q: –  How to setup never expired user password ?
Ans:- chage -E never username
Display or Kill all processes which are accessing any folder/file
Display User who are using file/folder : fuser -u file/folder
Kill All Processes which are using file/folder: fuser -k file/folder

Q: –  Kill any user’s all processes ?
Ans:-  killall -u username

Q: – How can we have daily system analysis and reports over mail ?
Ans:- Use logwatch

Q: –  How can we rotate logs using logrotate without performing any operation  like move and gzipping over original file and then creating new file (which is very lengthy process) ?
Ans:- We can use “logrotate”‘s “copytruncate” option which will simply copy original file and truncate original file icon smile Linux and Unix System Administration Interview Questions.

Q: –  Command to collect detailed information about the hardware and setup of your system ?
Ans:- dmidecode , sysreport

Q: –  Command to check PCI devices vendor or version ?
Ans:- lspci

Q: – Default Port numbers used by ssh,ftp,http,https,telnet,smtp,pop3,pop3s,imap,imaps ?
Ans:- SSH 22, ftp 20/21, http 80, https 443, SMTP/SMTPS 25/465, POP3/POP3S 110/995, IMAP/IMAPS 143/993.

Q: –  How to setup ACLs in following case ?
Ans:-
1) Create a file FILE1 and this should be read,write,executable for all user but Read only  for user USER1.
2) Copy FILE1 ACLs to FILE2 ACL.
3) Delete a USER1’s rule for FILE1 which were setup in step 1).
Ans 1) touch FILE1 ; chmod 777 FILE1 ; setfacl -m u:USER1:r FILE1
2) getfacl FILE1 | setfacl –set-file=- FILE2
3) setfacl -x u:USER1 FILE1

Q: –How to setup Passwordless remote login/ssh ?
Ans:- Use “ssh-keygen -t dsa or rsa” at local system for creating public and private keys
Then copy /root/.ssh/id_dsa.pub to remote_server by name /root/.ssh/authorized_keys
Change permissions of /root/.ssh/authorized_keys file at remote_server “chmod 0600 ~/.ssh/authorized_keys”
Now try to login from local system to remote_server “ssh root@remote_server”

Q: – Command to see default kernel image file ?
Ans:-  “grubby –default-kernel”

Q: – How to create lvm mirror ?
Ans:- lvcreate -L 50G -m1 -n LVM mirror vg0

Q: – Command to check last runlevel ?
Ans:- who -r

Q: – What do you mean by File System ?
Ans:- File System is a method to store and organize files and directories on disk. A file system can have different formats called file system types. These formats determine how the information is stored as files and directories.

Q: – What is the requirement of udev daemon ?
Ans:- Create and remove device nodes or files in /dev/ directory

Q: – How to Convert ext2 to ext3 File System ?
Ans:-  tune2fs -j /dev/{device-name}

 Q: – Commands used to install, list and remove modules from kernel ?
Ans:- Installing/adding a module:
insmod mod_name
modprobe mod_name
List installed modules :  lsmod
Removing a module     : modprobe -r mod_name

Q: – File which stores the DNS configuration at client side ?
Ans:- /etc/resolve.conf

Q: – File required to modify for setting up kernel parameters permanent ?
Ans:-  /etc/sysctl.conf

Q: – What vmstat show ?
Ans:- vmstat (virtual memory statistics) is a computer system monitoring tool that collects and displays summary information about operating system memory, processes, interrupts, paging and block I/O.

Q: – What is the difference between screen and script commands?
Ans:-  Screen is an screen manager with VT100/ANSI terminal emulation and used to take GNU screen session remotely or locally and while Script make typescript of terminal session.
Screen : needs to be detached, should not be excited to access remotely/locally
Script : creates a file and store all the terminal output to this file

Q: – How can we check which process is assigned to which processor ?
Ans:- Run “ps -elFL” and find out the PSR column which is showing the processor number to the process

Q: –  How to make USB bootable ?
Ans:-
Write efidisk.img from RHEL 6 DVD images/ subdirectory to USB
dd if=efidisk.img of=/dev/usb (usb device name)

 Disable ping to avoid network/ICMP flood
Set following in /etc/sysctl.conf : net.ipv4.icmp_echo_ignore_all = 1
Then “sysctl -p”
      or
echo “1” > /proc/sys/net/ipv4/icmp_echo_ignore_all

Q: – How to create swap using a file and delete swap ?
Ans:-
Adding swap :
dd if=/dev/zero of=/opt/myswap bs=1024 count=4
mkswap /opt/myswap
swapon -a
For adding this myswap at boot time, add following in /etc/fstab file:
/opt/myswap       swap     swap   defaults   0 0

Deleting Swap :
Run “swapoff /opt/myswap” command
Remove the entry from /etc/fstab file
Remove /opt/myswap file (using rm command)

Q: – What Squid service do ?
Ans:- Squid provides the Proxy service, which caches and filters web traffic.

Q: – Which popular office suite freely available for both Microsoft and Linux ?
Ans:- Open office suite is freely available. You can install it on both OS Microsoft and Linux.

Q: – You company recently switched from Microsoft to Linux. All their documents are created on Microsoft office 2007. How will you manage documents created on Microsoft office 2007 ?
Ans:- Install open office suite in Linux. It allows you work with Microsoft documents.

Q: – Name any of three spreadsheet programs, those are equivalent to Microsoft Excel and available for Linux ?
Ans:-
Openoffice calc [Free]
KOffice Kspread [Free]
StarOffice Base [commercial ]
Corel Quattro [commercial]

Q: –  What is the SMTP ?
Ans:- SMTP is the most common protocol for an e-mail server.

Q: –  What is NNTP ?
Ans:- NNTP is the common protocol which is used for news services. LeafNode and INN are examples of news servers.

Q: – Which port should you open in your host firewall to run web server ?
Ans:- By default web server use port 80 and 443 which you need to open in firewall.

Q: – Which IP addressing should you use for Server?
Ans:- For server you should always use static IP address.

Q: – Which IP address should you use for client desktop?
Ans:- For client you can use both static and dynamic method. For easy management using DHCP to assign IP address would be the best option.

Q: – Which ports should you open in host firewall for an email server?
Ans:- Open port 110 which is used by the POP3 e-mail protocol.
Open port 25 which is used by the SMTP e-mail protocol.
Open port 143 which is used by the IMAP e-mail protocol.

Q: – You have a file (say virgin.txt). You want this file to be alter-proof so that no one can edit or delete this file, not even root. What will you do?
Ans:-  # chattr +i virgin.txt
# rm -r virgin.txt (Remove the file using normal user)
# rm -r virgin.txt (Remove the file using root user)

If several users are using your Linux Server, how will you find the usage time of all the users, individually on your server?
# apt-get install acct
# ac -p

Q: – It is possible to send query to BIOS from Linux Command Line?
Ans:-  # biosdecode

Q: – Most of the Linux Server are headless, i.e., they run in command mode only. No GUI is installed. How will you find hardware description and configuration of your box?
Ans:- # dmidecode
# dmidecode > /path/to/text/file/text_file.txt

Q: – Is it possible to mount an NTFS partition on Linux?
Ans:- Yes! We can mount an NTFS partition/disk on Linux system using application ‘mount.ntfs’ which optionally is called as ‘ntfs-3g’ in order to mount ntfs partition on Linux System.




Q: – What and where you need to edit so that the default desktop at login will be KDE, which at present is GNOME ?
Ans:-
We need to edit a file ‘/etc/sysconfig/desktop’ and add/edit the below lines to load KDE by default and not GNOME.
DESKTOP=”KDE”
DISPLAYMANAGER=”KDE”

Q: – What is the basic difference between UNIX and Linux Operating System?
Ans:- Linux is free and open-source software (allowing programmers to program with Linux not around it), the kernel of which is created by Linus Torvalds and community. UNIX, on the other hand, is UNIX is copyrighted name only big companies are allowed to use the UNIX copyright and name, so IBM AIX and Sun Solaris and HP-UX all are UNIX operating systems.

Q: – What is the core of Linux Operating System?
Ans:-
Shell
Kernel
Command
Script
Terminal

The core of the Linux operating system is Kernel. It is broken down into Shell, Command, Script, and Terminal. Shell is a command Line Interpreter, Command is user Instruction to Computer, Script is collection of commands stored in a file, and Terminal is a command Line Interface.


Q: – What is an INODE?
Ans:- All files have its description stored in a structure called ‘inode’. The inode contains info about the file-size, access and modification time, permission and so on. In addition to descriptions about the file, the inode contains pointers to the data blocks of the file.

Q: – What is the difference between TCP and UDP?
Ans:- The basic difference is that TCP establishes a connection before sending data and this allows it to control the dataflow and guarantee that all packets get delivered. UDP simply chucks datagrams onto the wire and if some get lost or arrive in bad order there’s no way to request a resend. However UDP has low network overhead so some services such as DNS resolution, SNMP, DHCP, RIP and VOIP use UDP for its speed and any errors are usually dealt with on the application layer rather than network layer.

Q: – How does DNS resolution work?
Ans:- A client application requests an IP address from the name server usually by connecting to UDP port 53.
 The name server will attempt to resolve the FQDN based on its resolver library, which may contain authoritative information about the host requested or cached data about that name from an earlier query.
If the name server does not already have the answer, it will turn to root name servers to determine the authoritative for the FQDN in question.
Then, with that information, it will query the authoritative nameservers for that name to determine the IP address.

Q: – What is an MX record?
Ans:- An MX record numerically ranks the mail servers you would prefer to receive email for a domain. The MX record with the lowest number is preferred over the others, but you can set multiple email servers with the same value for simple load balancing.

Q: – How do you list and flush all IPtables ?
Ans:- First you use the –L switch to view all the currently present rules and then –F to flush them.

Q: – How To check Memory stats and CPU stats ?
Ans:-  Using ‘free’ & ‘vmstat’ command we can display the physical and virtual memory statistics respectively.With the help of ‘sar’ command we see the CPU utilization & other stats.

Q: – What is a shell? What are their names?
Ans:- The shell is the part of the system with which the user interacts. A Unix shell interprets commands such as “pwd”, “cd” or “traceroute” and sends the proper instructions to the actual operating system itself. The shells currently available areAns SH, BASH, CSH, TCSH, NOLOGIN, KSH. Other functions of a shell include scripting capability, path memory, multitasking, and file handling.



Q: – Why is LVM is required ?
Ans:- LVM stands for Logical Volume Manager , to resize file system's size online we required LVM partition in Linux. Size of LVM partition can be extended and reduced using the lvextend & lvreduce commands respectively.

Q: – How to create partition from the raw disk ?
Ans:-Using fdisk utility we can create partitions from the raw disk.Below are the steps to create partition from the raw dsik :
– fdisk  /dev/hd* (IDE) or /dev/sd* (SCSI)
– Type n to create a new partition
–  After creating partition , type w command to write the changes to the partition table.

Q: – Where the kernel modules are located ?
Ans:- The ‘/lib/modules/kernel-version/’ directory stores all kernel modules or compiled drivers in Linux operating system. Also with ‘lsmod’ command we can see all the installed kernel modules.

Q: – How to check default route and routing table ?
Ans:-Using the Commands ‘netstat -nr’ and ‘route -n’ we can see the default route and routing tables.

Q: –  How to check which ports are listening in my Linux Server ?
Ans:- Use the Command ‘netstat –listen’ and ‘lsof -i’

Q: –  List the services that are enabled at a particular run level in linux server ?
Ans:- With the help of command ‘chkconfig –list | grep 5:on’ we can list all the service that are enabled in run level5. For other run levels just replace 5 with the respective run level

Q: –  How to enable a service at a particular run level ?
Ans:-We can enable a service using the Command ‘chkconfig <Service-Name> on –level 3′

Q: – How to upgrade Kernel in Linux ?
Ans:- We should never upgrade Linux Kernel , always install the new New kernel using rpm command because upgrading a kernel can make your linux box in a unbootable state.



Basic Command for Linux and Ubuntu

October 14, 2019
Basic Command for Linux and Ubuntu
Image result for Basic Command for Linux and Ubuntu




Recognised Ubuntu flavours (APT)
Edubuntu — Ubuntu for education
Ubuntu GNOME — Ubuntu with the GNOME desktop environment
Kubuntu — Ubuntu with the K Desktop environment
Ubuntu Kylin — Ubuntu localised for China
Lubuntu — Ubuntu that uses LXDE
Mythbuntu — Designed for creating a home theatre PC with MythTV
Ubuntu Studio — Designed for multimedia editing and creation
Xubuntu — Ubuntu with the XFCE desktop environment

Links to Download Open Source
Ubuntu   ---- https://www.ubuntu.com/
Debian  ----- https://www.debian.org
Linux Mint  --- https://www.linuxmint.com
Puppy Linux -- https://www.puppylinux.org
TinyCore ---- http://distro.ibiblio.org/
MEPIS Linux --- http://www.mepis.org/
Zorin OS --- http://zorin-os.com/
FreeBSD--- http://www.freebsd.org

Recognised Linux flavours (YUM)
Redhat Linux --- http://in.redhat.com
CentOS --- http://www.centos.org/
OpenSUSE--- http://www.opensuse.org/
Fedora ---http://fedoraproject.org/
Slackware--- http://www.slackware.com/
OpenSolaris --- http://distrowatch.com/
IPFIRE     --- http://www.ipfire.org/



Sudo Means
sudo     (super user do)
su         (superuser)

To See Ip address and Mac address
ifconfig
ifconfig -a
ifconfig eth1 up
sudo lshw -C network
sudo ifconfig eth1 up
sudo /etc/init.d/networking restart

System Architecture
Distribution and version of Linux
uname -m
cat /proc/version

Kernel Requirements
uname -r

Memory Requirements
grep MemTotal /proc/meminfo
uname -m
grep SwapTotal /proc/meminfo

Automatic Memory Management
df -h /dev/shm/

Disk Space Requirements
df -h
df -h /tmp
df -h /home

mtr Command means - ping and traceroute                  
Type :- mtr google.com
swapon -s   check swap size

Install :- sudo apt-get install mtr 


Password
sudo smbpasswd -a <user_name>

1. Ctrl+x+e Command - open editor by typing vi, vim, nano, etc
2. nl Command  -  number the lines of a file
eg:- cat > file.txt
        nl file.txt

3. shuf Command - randomly select lines/files/folder from a file/folder
eg:-  ls
ls | shuf (shuffle Input)
ls | shuf -n1

4. To determine the size of the configured swap space, enter the following command:
# grep SwapTotal /proc/meminfo

ss Command  --  socket statistics similar to netstat command
last Command -- history of last logged in users
curl ifconfig.me  --  External IP address
tree command --
pstree --
<space> Command  -  (ls, pwd, uname, echo “hi” and who)
history
stat Command --  status information


mount | column -t  --  mounted filesystem
Ctr+l command -- clear
file
look Command - ubuntu
id -- user and group ids.
strace Command  -- troubleshooting
strace pwd
disown -a && exit Command  --- control jobs running in the terminal background
 lsb_release  ---  print distribution-specific information
lsb_release -a


getconf LONG_BIT Command -- machine architecture
watch -t -n1 "date +%T|figlet  --  first install figlet
host and dig Commands  -  DNS lookup utility
dstat Command --  generates statistics relating to system resource
bind -p Command
nc -zv localhost 80
curl ipinfo.io -- ‘Geographical Location
find .  -user root   --- files with respect of the user (root) owned files
eg :- find . -user avi
apt-get build-dep ffmpeg -- dependency, automatically during the corresponding package installation





lsof -iTCP:80 -sTCP:LISTEN ---- process/service
ind -size +100M
Startx — :1

To determine the amount of free disk space on the system, enter the following command:
# df -k

To determine whether the required packages are installed, enter commands similar to the following:
# rpm -q package_name

To determine whether the required kernel is installed, enter the following command:
# uname -r

Internet troubleshoot
sysctl -p
sysctl -a | grep syn
sysctl -a | fgrep tcp
sysctl -A | grep na
sysctl -a | grep flush
ip route flush cache
ls -l /proc/sys/net/ipv4/route/flush

Open SSH Requirement for Minimal Installation
# rpm -qa | grep ssh

physical RAM size
grep MemTotal /proc/meminfo
free

the size of the configured swap space
grep SwapTotal /proc/meminfo

amount of space available in the /tmp directory,
df -h /tmp

 free disk space on the system
df -h

system architecture can run the software
uname -m

the processor architecture matches the Oracle software release to install
x86_64

1. LS (List Directory Contents)
ls (list files and directories)
ls -l (long listing)
ls -a (hidden)
Example :- drwxr-xr-x 2 ubuntu ubuntu 4096 June 5 14:50 Desktop
d (Directory)
rwxr-xr-x (owner, group and world)
1st ubuntu file is owned by user ubuntu
2nd ubuntu file belongs to user group ubuntu
4096 (file size in Bytes)
June 5 14:50 (date and time of last modification)
And at the end is the name of the File/Folder
ls -lh (Human Readable Format)
ls -F (will add the ‘/’ Character at the end each directory)





ls -r (List Files in Reverse Order)
eg :- Videos     Public    Music

ls -R (Recursively list Sub-Directories)
eg :- -rw-------. 1 root     root      33408 Aug  8 17:25 anaconda.log

ls -ltr (Reverse Output Order)
eg:- -rw-------. 1 root root  1586 Jul 31 02:17 anaconda-ks.cfg
        -rw-r--r--. 1 root root   683 Aug 19 09:59 0001.pcap

ls -lS (Sort Files by File Size)
eg:-  -rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log
         drwxr-xr-x. 4 root root  4096 Aug 16 02:55 Downloads

ls -i (Display Inode number)
eg:- 20112 0001.pcap        23610 Documents

ls --version (Shows version)
ls --help (Help Page)
ls -l /tmp (List Directory Information)
ls -ld /tmp/ (/tmp directory)
ls -n (Display UID and GID of Files)
alias ls="ls -l" (ls command and it’s Aliases)
alias
unalias ls

2. lsblk (List Block Devices)
“lsblk -l (list Structure) 


3. md5sum (Compute and Check MD5 Message Digest)
eg :-  md5sum teamviewer_linux.deb

4. dd (Convert and Copy a file)
eg :- dd if=/home/user/Downloads/debian.iso of=/dev/sdb1 bs=512M; sync

5. uname
eg :- uname -a

Linux tecmint 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:36:13 UTC 2013 i686 i686 i686 GNU/Linux
“Linux“: The machine’s kernel name.
“tecmint“: The machine’s node name.
“3.8.0-19-generic“: The kernel release.
“#30-Ubuntu SMP“: The kernel version.
“i686“: The architecture of the processor.
“GNU/Linux“: The operating system name.

5. uname
eg :- uname -a

Linux tecmint 3.8.0-19-generic #30-Ubuntu SMP Wed May 1 16:36:13 UTC 2013 i686 i686 i686 GNU/Linux
“Linux“: The machine’s kernel name.
“tecmint“: The machine’s node name.
“3.8.0-19-generic“: The kernel release.
“#30-Ubuntu SMP“: The kernel version.
“i686“: The architecture of the processor.
“GNU/Linux“: The operating system name.

6. history
7. mkdir (make directory)
8. touch (Update the access and modification times of each FILE to the current time)
eg :- touch newfilename

Permission
9. chmod (change file mode bits)

There exist 3 types of permission
Read (r)=4
Write(w)=2
Execute(x)=1
To change its permission and provide
read  - owner
write - group
and execute - world.

Now permission need to be set for 3 kinds of user and usergroup. The first is owner, then usergroup and finally world.
usergroup  ----  r-x (read and execute no write permission).
world is             –x (only execute).


Eg :- chmod 777 abc.sh

10. chown - (change file owner and group)
ls -l
11. apt  -  (Advanced Package Tool)
12. tar - (Tape Archive )
tar -zxvf abc.tar.gz (Remember 'z' for .tar.gz)
tar -jxvf abc.tar.bz2 (Remember 'j' for .tar.bz2)
tar.gz‘ means gzipped ---  ‘tar.bz2

13. cal - Calendar
cal 02 1835
14. date
15. cat
16.  Wildcard            Matches
   *            zero or more characters
   ?            exactly one character
[abcde]            exactly one character listed
 [a-e]            exactly one character in the given range
[!abcde]        any character that is not listed
 [!a-e]            any character that is not in the given range
{debian,linux}        exactly one entire word in the options given

17. cp - Copy
18. mv - moves
19. pwd - (print working directory
20. cd - change directory


How to Enable EPEL Repository for RHEL/

What is EPEL
EPEL (Extra Packages for Enterprise Linux) is open source and free community based repository project from Fedora team which provides 100% high quality add-on software packages for Linux distribution including RHEL (Red Hat Enterprise Linux), CentOS, and Scientific Linux. Epel project is not a part of RHEL/Cent OS but it is designed for major Linux distributions by providing lots of open source packages like networking, sys admin, programming, monitoring and so on. Most of the epel packages are maintained by Fedora repo.

Why we use EPEL repository?
provides lots of open source packages to install via Yum.
Epel repo is 100% open source and free to use.
It does not provide any core duplicate packages and no compatibility issues.
All epel packages are maintained by Fedora repo.

RHEL/CentOS 6  32-Bit
1. wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
2. rpm -ivh epel-release-6-8.noarch.rpm
          
RHEL/CentOS 6  64-Bit
wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm



How Do I Verify EPEL Repo?
yum repolist

How Do I Use EPEL Repo?
yum --enablerepo=epel info zabbix
zabbix is a example

install zabbix
yum --enablerepo=epel install zabbix

Note: The epel configuration file is located under /etc/yum.repos.d/epel.repo.
This way you can install as many as high standard open source packages using EPEL repo.



How to Install Ambient Noise Music Player Application in Ubuntu 19.04, Debian and Linux Mint

October 14, 2019
How to Install Ambient Noise Music Player Application in Ubuntu 19.04, Debian and Linux Mint

How to Install, Implement or Configure Access Control List (ACL) in CentOS 7

October 14, 2019
How to Install, Implement or Configure Access Control List (ACL) in CentOS 7
Image result for How to Install ACL in CentOS 7




 1.  Create required users & group.
#  useradd  tom
#  groupadd salesgrp
#  groupadd fingrp
#  mkdir /salesdept
#  useradd  -g  salesgrp  Karen
#  useradd  -g  salesgrp  John
#  useradd  -G  fingrp  tom
#  useradd  -G  fingrp  meet

2.  Add a file by using  ‘cat’  command.

#  cat  >   abc.txt

3. To apply acl’s on users & groups
#  setfacl  -m


4. To check acl list
#  getfacl  abc.txt

How to Run Shell Script to Monitor Network Usage, Disk Usage, Uptime and RAM in Ubuntu 19.04

October 14, 2019
How to Run Shell Script to Monitor Network Usage, Disk Usage, Uptime and RAM in Ubuntu 19.04




Note :- We have taken care of formatting the output (to certain extent). The Script don’t contains any Malicious contents and it can be run using Normal user Account. In-fact it is recommended to run this script as user and not as root.

Download the Script
Step1 :-  http://jmp.sh/v/aCo3L7Qrm8FzwWn1tqGP
Step2 :-  chmod 755 cloudnetwork_monitor.sh



To install
Step3 :-   ./cloudnetwork_monitor.sh -i
Step4 :-    monitor


As soon as you run the command you get various System related information which are:
Internet Connectivity
OS Type
OS Name
OS Version
Architecture
Kernel Release
Hostname
Internal IP
External IP
Name Servers
Logged In users
Ram Usages
Swap Usages
Disk Usages
Load Average
System Uptime







Friday, October 11, 2019

How to Install VLC in Ubuntu, Debian & Linux Mint

October 11, 2019
How to Install VLC in Ubuntu, Debian & Linux Mint




Original Website :- https://www.videolan.org

Install VLC  in Ubuntu,  Debian & Linux Mint

VLC  is a free download for Windows, Mac, Linux and a slew of mobile platforms, including Windows Phone, Android and iOS.

Step1 :-   sudo add-apt-repository ppa:videolan/stable-daily

Step2 :-   sudo apt-get update && sudo apt-get install vlc

How do we Crack an Android Phone Pattern Password ?

October 11, 2019
How do we Crack an Android Phone Pattern Password ?

FIRST METHOD  [ FLASHING ZIP FILE ONLY ]
SECOND METHOD [ USING ADB ]


1. FIRST METHOD  [ FLASHING ZIP FILE ONLY ]

This is easiest method to crack android pattern lock you have to just flash a small zip file into recovery but in some cases it doesn’t work without root(very rare cases), you must try this once because this is too easy to do. you must have custom recovery installed (like CWM or TWRP) to use this method.

1. First of all download Lockscreen security Bypass.zip file.
(http://forum.xda-developers.com/attachment.php?attachmentid=2245081&d=1378720290)

2. Copy the zip file into root folder of your SD card.

3. After copying zip file to SD, boot your phone into Recovery mode(Each phone has different key combination to boot up in recovery mode, find it for your phone).

4. In recovery choose “install zip from SD card or apply update from SD card”, now select “Lockscreen Security bypass.zip” which you have downloaded earlier.

5. After selecting zip file it will start installing when installation is complete, now reboot your device.

6. After rebooting it still demands Password or Gesture, don’t worry give it any password or gesture it will get unlocked Automatic.

2.  SECOND METHOD [ USING ADB ]

Thus process is bit lengthy compared to first method. As usual requirement is also bigger than first method. Rarely root is required in this method.

1.Your device’s driver must be installed on your PC or Laptop.

2.Most important “USB debugging must be enabled on your phone”  without this method will fail!   Download ADB and fastboot files.zip file.
(http://www.mediafire.com/download/9ylow29klhccc0x/Fastboot.zip)

3.After downloading extract it on your Desktop(we are going to use these extracted files so it is easy to access them if they are on desktop).

4.Now open the extracted folder (fastboot), here you will find 4 files named as:

5.Now connect your phone to your PC or Laptop.

6.After connecting your mobile press and hold “Shift button” and press right click on empty space, after clicking option will prompted like view,sort by,group by,etc “select open Command window here”.

7.when command prompt open type “adb devices” to check that your device is properly connected or not. If it show some Random numbers in command prompt it means your device is connected otherwise not(the reason behind not connected is that your driver are not successfully installed on your computer).

8.Now there are two methods you should check both of them look which will work for you.

a).Type the following command into command prompt.
adb shell cd /data/data/com.android.providers.settings/databases sqlite3 settings.db update system set value=0 where name='lock_pattern_autolock'; update system set value=0 where name='lockscreen.lockedoutpermanently'; .quit

b).If the above code does not work type this one into command prompt.
adb shell rm /data/system/gesture.key