Placeholder for our stuff related to Telecom, IT, Internet of things (IOT), ESP8266, Raspberry Pi

Home IOT Telecom IT stuff About Us Contact Us Site Map

Linux and Solaris Commands

Check LAN cable connected or not on eth port
Check link-speed

Replace port names as per your machine


# ethtool nic0 | grep "Link detected"
Link detected: yes

# ethtool nic7 | grep "Link detected"
Link detected: no

# ethtool nic0 | grep -E 'Duplex|Speed|Auto-nego|detect'
Speed: 100Mb/s
Duplex: Full
Auto-negotiation: on
Link detected: yes


# dladm show-dev
e1000g0 link: unknown speed: 0 Mbps duplex: half
ixgbe0 link: up speed: 1000 Mbps duplex: full
ixgbe1 link: up speed: 100 Mbps duplex: full
ixgbe2 link: unknown speed: 0 Mbps duplex: unknown
ixgbe3 link: unknown speed: 0 Mbps duplex: unknown

# dladm show-link
e1000g0 type: non-vlan mtu: 1500 device: e1000g0
ixgbe0 type: non-vlan mtu: 1500 device: ixgbe0
ixgbe1 type: non-vlan mtu: 1500 device: ixgbe1
ixgbe2 type: non-vlan mtu: 1500 device: ixgbe2
ixgbe3 type: non-vlan mtu: 1500 device: ixgbe3

If you are running solaris versions older then 10, then try following
ndd –get /dev/ixgbe0 link-status
ndd –get /dev/ixgbe0 link-speed

Ping continuously


ping -t


ping -s

Find File or Directory


Search myfile.html in dir /var/opt
# find /var/opt -name myfile.html

# find /var/opt -name "myfile.html"

Case insensitive search
# find /var/opt -iname MyFiLE.Html

Find files based on content of file
# find . -type f -exec grep -l "moduleName" '{}' \;

Above command will show only file names containing pattern, use this if you want to see matched lines as well
# find . -type f -exec grep -H "moduleName" '{}' \;

Use this if you know the filename
# find /var/opt -type f -iname myfile* -exec grep "Some Content in file" '{}' \;

You don't want to see error messages like "Permission denied". Redirect the error output (stderr) to /dev/null.
# find / -name myfile.xml 2>/dev/null

Find all .xml files (ignoring text case) modified in the last 5 days by a user named dbuser.
# find /var/opt/ -user dbuser -mtime 5 -iname ".xml"

Search for Directory
find /var/opt/ -type d -iname MyDirectory

Set up ILOM IP in Oracle Solaris X3-2


Connect to serial console and give following commands

View existing ILOM IP address:
-> show /SP/network

To set ILOM IP address to GW
-> cd /SP/network
-> set pendingipaddress=
-> set pendingipnetmask=
-> set pendingipgateway=
-> set pendingipdiscovery=static
-> set commitpending=true
-> set state=enable
-> reset /SP
-> Start SYS

Packet Trace


tcpdump -i any
tcpdump -i any host
tcpdump -i nic0
tcpdump -i any host -w /tmp/failover11.pcap

Ring buffer capture (rotating capture) running in background.
Leave SSH session open or close out of the SSH session by typing "exit" .   Note:  if you close out the SSH session by simply closing Putty, the process will stop.

tcpdump -i any -n -s 0 -C 1 -W 3 -w /tmp/rotateCapture.pcap &

To stop capture use "ps -ef | tcpdump" to find pid and kill -9 pid


snoop –o x42d port 2427 filepath
snoop -d ixgbe0 -o /tmp/mytrace1.pcap host
snoop -d ixgbe0 -o /tmp/hpsbc1.pcap host or host
snoop -d ixgbe0 -o /tmp/mytrace2.pcap port 5060

snoop -d ixgbe0 port 2905

snoop -dV ixgbe2 port 5060

Server Serial Number


sudo dmidecode -t system


ipmitool fru

Find Host ID




sysdef -h

tar, untar, zip, unzip


tar xfvz myfile.tar.gz


gzip -dv myfile.tar.gz
tar xfv myfile.tar

#tar and zip a folder and remove original folder
tar -zcvf backupDir.tgz backupDir --remove-files


Enable Disable Services


/sbin/service sendmail stop
/sbin/service sendmail start
/sbin/service sendmail status


svcadm enable ssh
svcadm disable ftp
svcs ftp

Configure password less ssh, sftp


User adminA of server A.A.A.A wants to do password less ssh to server B.B.B.B user adminB

1. Login on server A.A.A.A with user adminA
2. ssh-keygen -b 2048 -t rsa -f ~/.ssh/id_rsa -q -N ""
3. ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

Now try ssh [email protected]


Fill up space quickly in a folder

fallocate -l 10G gentoo_root.img

Find Directory Size


du /path -skh

# du /config/ -skh
3.8G /config/


Size of directory in human readable units
# du -sh /tmp
720M /tmp

Size of directory in kb
# du -sk /tmp
737172 /tmp

Find out which folder is taking up all the space


du -h --max-depth=1 /path

start with root and repeat command for biggest folder

[root@admin]# du -h --max-depth=1 /
2.4G /usr
4.0K /home
4.0K /srv
14M /sbin
661M /root
4.0K /mnt
16K /lost+found
1.3G /var
4.0K /cgroup
3.8G /config
4.0K /media

[root@admin]# du -h --max-depth=1 /config
3.8G /config/myconfig
16K /config/lost+found
4.0K /config/fms
8.0K /config/kvm
3.8G /config


Find size of root in kb
# du -sk /

Find size of each file and sub directory in root. output sorted by max size dir in the end
# du -sk /* | sort -n

Use following if you want max size file/folder first
# du -sk /* | sort -nr

Repeat for biggest folder
# du -sk /reserved/* | sort -nr

Use -h switch to get human readable output. Don't use sort with -h switch, it will not give you size sorted output
# du -sh /reserved/*

Find OS version


cat /etc/redhat-release
cat /etc/centos-release


cat /etc/release

Find OS is 32 bit or 64 bit


uname -a


isainfo -b


To search for lines containing string1 or string2 in file my_file.txt:
grep -E string1\|string2 my_file.txt

To search for lines not containing string1 or string2 in file my_file.txt:
grep -v -E string1\|string2 my_file.txt

To search for lines containing both string1 and string2 in file my_file.txt:
grep -e string1 -e string2 my_file.txt

To search for lines not containing both string1 or string2 in file my_file.txt:
grep -v -e string1 -e string2 my_file.txt

Search pattern in file and print 2 lines after it
grep -A 2 CCL AppParams.xml

Search pattern in file and print 2 lines before it
grep -B 2 CCL AppParams.xml

Search pattern in file and print 2 lines after and 2 line before it
grep -C 2 CCL AppParams.xml

Print filename in output
grep -H CCL AppParams.xml

Remove comments and see just uncommented config parameters
# grep -v '^ *#' /etc/myconfig.txt
Search pattern in zip file
# zgrep myPattern myfile.gz

Output Redirection

To redirect your echo to a file:
echo something > myfile.txt

To redirect your echo to a file to append:
echo something >> myfile.txt

Also, output can be sent to the screen AND to a file at the same time:
echo something | tee myfile.txt

The above command would replace any existing file. More commonly, you would append to the file:
echo something | tee -a myfile.txt

> file       redirects stdout to file
1> file      redirects stdout to file
2> file      redirects stderr to file
&> file      redirects stdout and stderr to file

Last Reboot or Shutdown

# last -5 reboot shutdown root
This will give you the last 5 reboot, shutdown, and root (console shutdown included) entries in the wtmp log.


reboot ~ Mon Mar 23 14:51
shutdown ~ Mon Mar 23 14:49
root console Mon Mar 23 14:49 - shutdown (00:00)
reboot ~ Mon Mar 16 09:54
shutdown ~ Thu Mar 12 17:41

Recursive FTP

Use wget to recursive ftp download
# wget -r --user="Nevada" --password="password";type=i

To dowload in ASCII mode use the type=a
Note that even if -r is for recursion, it has a default max level of 5.
If you don't want to miss out subdirs, better use the mirroring option, -m

Split and Join binary files

Note down md5sum of file and split in 50 MB chunks

# md5sum myImage.iso
# split -b 50M myImage.iso

FTP file created to remote machine, join files usinf cat and compare md5sum.
# cat x?? > myImage.iso
# md5sum myImage.iso

Use yum to download a package and dependencies without installing

# yum install --downloadonly --downloaddir=<directory> <package>
then test and install
# rpm -U *.rpm --test
# rpm -U *.rpm


Suresh Hariramani

I am an IOT enthusiast with more than 20 years of experience in the IT sector. Specializing in telecom service's; follow me for some very innovative and best in class IOT products as I unfold my knowledge and passion for the subject.


Vatsal Hariramani

Just me, myself and I, exploring the universe of uknownment. I have a heart of love and interests in technology, IOT and travel . And I want to share my world with you .