UNIX/Linux Basic Command Reference

File Commands

ls – directory listing

ls -all – formatted listing with hidden files

cd dir– change directory

cd– change to home

pwd– show current directory

mkdir dir– create a directory dir

rm file– delete file

rm -r dir– delete directory dir

rm -f file– force remove file

rm -rf dir– force remove directory dir*

cp file1 file2– copy file1 to file2

cp -r dir1 dir2 – copy dir1 -copy dir1 to dir2; create dir2 if it doesn’t exist

mv file1 file2– rename or move file1 to file2 if file2 is an existing directory, moves file1 into directory file2

ln -s file link– create symbolic link link to file

touch file– create or update file

cat > file-places standard input into file

more file– output the contents of file

head file– output the first 10 lines of file

tail file– output the last 10 lines of file

tail -f file– output the contents of file as it grows, starting with the last 10 lines

Process Management 

ps-display your currently active process

top– display all running process

kill pid– kill process id pid

killall proc– kill all processes named proc *

bg– lists stopped or background jobs; resume a stopped job in the background

fg n– brings job n to the foreground

 

File Permission

chmod octal file– change permission of file to octal, which can be found separately for user,group, and world by adding:

  • 4 – read(r)
  • 2 – write(w)
  • 1 – execute(x)

Examples:

chmod 777 – read, write, execute for all

chmod 755 – rwx for owner, rx for group and world, for more option see man chmod.

 

SSH

ssh user@host – connect to host as user

ssh -p port user@host – connect to host on port, port as user

ssh – copy-id user@host -add your key to host for user to enable a keyed or passwordless login

 

Searching 

grep pattern files – search for pattern in files

grep -r pattern dir – search recursively for pattern in dir

command | grep pattern – search for pattern in the output of command

locate file – find all instances of file

 

System Info

date – show the current date and time

cal – show this month’s calender

uptime – show current uptime

W – display who is online

whoami – who you are logged in as

finger user – display information about user

uname -a – show kernel information

cat /proc/meminfo – memory information

man command – show the manual  for command

df – show disk usage

du – show directory space usage

free – show memory and swap usage

whereis app – show possible locations of app

which app – show which app will be run by default

 

Compression

tar cf file.tar files – create a tar named file.tar containing files

tar xf file.tar – extract the files from file tar

tar czf file.tar.gz files – extract a tar using Gzip

tar cjf file.tar.bz2 – create a tar with Bzip2 compression

Network

ping host – ping host and output results

whois domain – get whois information for domain

dig domain – get DNS information for domain

dig -x host – reverse lookup host

wget f – download file

wget -c file – continue a stopped download

 

Installation

install from source:

./configure make make install.

dpkg -i pkg.deb – install a package (Debian)

rpm -Uvh pkg.rpm – install a package (RPM)

 

Shortcuts

Ctrl+C – halts the current command

Ctrl+Z – stops the current command resume with fg in the foreground or bg in the background

Ctrl+D – logout the current session similar to exit

Ctrl+W – erases one word in the current line

Ctrl+U – erases the whole line

Ctrl+R – type to bring up a recent command

!! – repeats the last command

exit – log out of current session

 

 

 

 

 

 

 

 

Deep Dive – Choosing Openfiler for your Home Lab

Hey All, Here we came with the new deep dive topic for choosing the Openfiler as storage for your virtual environment.

Here we are going to setup our lab before we explore anything new. Initially, we are using 4 physical machines to setup our Virtualization lab. Out of these 4 servers or can say workstations, we are going to use one machine for storage purpose as we do not have any storage in hand as of now. Hence we have planned to use OpenFiler for storage purpose which provides a simple way to deploy and manage networked storage.

You can download Openfiler from below given link.

https://www.openfiler.com/community/download

I am writing this blog to share our experience what we discussed last night while installing the Openfiler. Below points we discussed.

Environment: –

  • 4 Physical Machines
  • Out of four boxes, using one box for Openfiler as Storage.
  • Configuration of machine which we are using for Openfiler – i5/16GB/2 TB SATA/250GB SSD/2 NICs

Discussion Point: –

  1. Which Software shall we use for Free NAS purpose?
  2. Should be install Openfiler on each four servers and use virtual environment individually on each server? Or create a centralized storage using a single server as Openfiler box then share volumes with rest environment?
  3. If we are using Openfiler, should it be on VM workstation or install directly on bare-metal machine?
  4. If it will be on VM workstation, then how other Virtual environment exists in different physical servers will access the Volumes?
  5. What is performance impact on accessing the volumes over the LAN on other machines if we are installing Open filer on VM workstation?
  6. What are the performance benefits if we install OpenFiler directly on Bare-metal machine?
  7. Performance output when we access volumes over LAN.
  8. As of now we have two disks available in existing machine which we are using for Openfiler. We are not using any RAID configuring now. Now question was, where do we install it? Should it be installed on SATA or SSD?
  • SATA – 1 TB in Size
  • SSD – 240 Gig in Size

Conclusion: –

Here I am sharing our minutes of discussion.

  • We are going to use Openfiler as free NAS. We will use one server for Openfiler and rest 3 servers will be to create virtual environment I;e ESXi, vCenter, etc.
  • It will be installed directly on bare-metal machine.
  • Installation source will be USB stick, and destination will be SATA disk. We will add SSD disk as an additional volume.
  • While assessing the performance impact, we concluded that there will be definitely slight performance impact in comparison to use individually on each physical server. But as using 24 Port Gigabit switch to connect these all 4 physical servers, hence there won’t be much difference. Altogether we don’t need shared storage for all environment so this only solution left. Let me clear that we are not considering VSAN at this point.

Issues Reported: –

While started the installation of Openfiler directly on bare metal machine on one of the machine, we faced lot of errors mentioned below. To fix this, we had to format the physical disk as raw disk. Used CD Disk rather a USB stick to install the Openfiler.

Installation Stuck while choosing the source media.

Error:

What type of media contains the packages to be installed?

  • Local CD/DVD
  • Hard Drive
  • NFS directly
  • FTP
  • HTTP

Error - Installation of Openfiler

 

We didn’t see any option to choose USB Drive which we had plugged in as source file to install Openfiler. We proceeded to choose the options and we came to know that system is not detecting USB drivers. Hence, we used CD Disk to start the installation and it worked fine.

Please follow below article to Install and Configure Openfiler in your environment.

Step by Step Installation Guide for Using Openfiler

Step by Step Configuration Guide for Using Openfiler

Continue reading

What is ESXi hosts?

VMware ESXi is an Operating System and a VMware proprietary. It is a Hypervisor that is designed on VMkernel platform. ESXi hosts offers physical resources(CPU, Memory, NIC or local HDD) to running Virtual Machines on it. Virtual machines can have different OS or different set of Apps.

Few more facts about ESXi Hosts:-

  • ESXi hosts are managed through an interface which is BIOS-like console or through vSphere Command Like Interface (vCLI).
  • ESXi hosts come as a Installable package or can be Embedded(in firmware, USB or inside a BIOS chip).
  • ESXi hosts has a high security and a small disk footprint.

As, a recommendation we should install & configure ESXi hosts properly on supported hardware. All hardware can be verified by visiting VMware hardware Compatibility Guide. https://www.vmware.com/resources/compatibility/search.php?ESXI

 

 

Why use Virtual Machines?

Ever wondered why we should use Virtual machines over the Physical?

Here, we make it easier to understand:-

 

Physical Machines:-

  • Difficult to move or copy
  • Bound to a specific set of hardware components
  • Often has a short life cycle
  • Requires personal intervention to upgrade hardware

VM1.png

 

Virtual Machines:-

  • Easy to move and copy:
    • Packaged into set of files
    • No Dependency of physical hardware
  • Easy to manage:
    • Virtual machines are isolated from each other.
    • Protected from any hardware changes
    • Provides the ability to support old apps.
  • Allows servers to be easily consolidated

vm2.png

 

What is a Virtual Machine?

Virtual machine is set of computer files. It has an Operating System or Apps which imitates underlying hardware. It gets important to know what files make a virtual machine.

Please refer the slide and put through your questions.

$4FCBA2E156E5971D.jpg

ESXi Compatibility Checker Released

Today we are going to  discuss about ESXi Compatibility Checker. As an admin one of the common task for us to to upgrade ESXi environment regularly.

As you know for any fresh installation or any upgrade in vSphere environment, Admin has to check and validated hardware compatibility list and product interoperability matrix. Admin has to understand the data and validate them one by one manually which is tedious, time consuming and often prone to manual error when done at scale.

To over come this a fling has been introduced which is a python script ,which can validate VMware hardware compatibility and upgrade issues of ESXi. It will make whole process simple and easy .The catch is that with help of simple command you can validate the compatibility of ESXi. Now lets see what is the requirement of ESXi Compatibility checker.

 

To download  and run please click on below link:

https://labs.vmware.com/flings/esxi-compatibility-checker

Video: