UNIX – What is a sticky bit ?

History The sticky bit was first introduced in 1974 within the UNIX operating system. Its purpose was to instruct the operating system to place the process into swap once completed. Thus reducing the startup time of the process during further executions. However nowdays this usage is obsolete. Usage Instead, the sticky bit is now set … Read more

VIM: Set the Width of a Single TAB to 4 Spaces Wide

In this extremely short article we will provide you with the steps required to make the width of a single TAB only 4 spaces wide. This especially useful when using Visual Mode within VIM , in that you can indent large portions of text. Steps Within your ~/.vimrc file add the following lines. set shiftwidth=4   … Read more

SCP File Transfer Fails but No Error Message is Shown

Issue When using scp to copy a file the file fails to transfer, however there is no error message. Solution This issue can occur due echo commands within your .bashrc and how the scp program handles the output from these commands. This is a known bug within scp which can be viewed here. To resolve this … Read more

How do I tab multiple lines within VI ?

Within this article we will looking at the steps required to tab multiple lines within VI.This feature is great for ensuring readability, when editing indent based languages such as Python or just programming in general. Steps Press “<SHIFT> + v” to enter VISUAL LINE mode. Select the text you wish to indent but using either … Read more

Solaris BART (Basic Auditing and Reporting Tool)

BART (Basic Auditing and Reporting Tool) provides the ability to determine file-level changes at a granular level within the Solaris 10 operating system. This is achieved via the creation of 2 manifest files (a control-manifest and test-manifest), each manifest catalogs the attributes of each file and then a comparison is run between the files and … Read more

Compiling Rancid on an x86 Solaris 10 platform

Below shows you the steps in order to compile Rancid on an x86 Solaris 10 platform. RANCID monitors a router’s (or more generally a device’s) configuration, including software and hardware (cards, serial numbers, etc) and uses CVS or Subversion to maintain history of changes. Space on /var If you havent much space on /var run … Read more

Solaris 10 x86 – Error compiling from source

When compiling from source you may see the following errors occur :    /usr/include/sys/siginfo.h:259: error: parse error before “ctid_t”   /usr/include/sys/siginfo.h:292: error: parse error before ‘}’ token   /usr/include/sys/siginfo.h:294: error: parse error before ‘}’ token    /usr/include/sys/siginfo.h:390: error: parse error before “ctid_t”   /usr/include/sys/siginfo.h:392: error: conflicting types for `__proc’   /usr/include/sys/siginfo.h:261: error: previous declaration of `__proc’   /usr/include/sys/siginfo.h:398: error: conflicting … Read more

Solaris Compile configure: error: no acceptable grep could be found in

When compiling programs in Solaris you may find you recieve the following error (or something along the same lines) complaining about grep. checking for grep that handles long lines and -e… ./configure: line 3859: 13085 Killed “$ac_path_GREP” -e ‘GREP$’ -e ‘-(cannot match)-‘ <“conftest.nl” >”conftest.out” 2>/dev/null ./configure: line 3859: 13092 Killed                  “$ac_path_GREP” -e ‘GREP$’ -e ‘-(cannot … Read more

Solaris GCC Failure: errno 28, No space left on device

When trying to install the gcc package on Solaris you may find you get the following error : cpio: Cannot write “reloc/lib/gcc-lib/i386-pc-solaris2.10/3.3.2/cc1obj”, errno 28, No space left on device cpio: Cannot write “reloc/lib/gcc-lib/i386-pc-solaris2.10/3.3.2/cc1plus”, errno 28, No space left on device cpio: Cannot write “reloc/lib/gcc-lib/i386-pc-solaris2.10/3.3.2/collect2”, errno 28, No space left on device cpio: Cannot write “reloc/lib/gcc-lib/i386-pc-solaris2.10/3.3.2/f771”, … Read more

How to install SSH on Solaris 10 x86

This guide will show you how to install SSH on Solaris 10 x86 from the Solaris installation DVD. Mount CD If you havent enabled the feature that will automatically mount your CDROM drive you will need to mount it using the following commands : mkdir /cdrom Find the name of your cdrom -bash-3.00# iostat -En … Read more

Solaris Upgrade Export “Error: Failed to execute ‘gtar -c -C”

When running an upgrade_export on a Solaris Smart Centre you may receive the following error :     Compressing the files… gtar: Only wrote 2047 of 10240 bytes to export.tgz.tar gtar: Error is not recoverable: exiting now     Error: Failed to execute ‘gtar -c -C “/opt/CPsuite-R65/fw1/tmp/upgrade_temp_dir” -f “export.tgz.tar” .’ command [ 26409     1]@#######[10 May 15:35:27] Compress: … Read more

Unix Mount Commands

Samba mount -t cifs //[Windows IP]/[Share] /root/folder/ -o user=[username],pass=[password],nocase BSD mount -t cd9660 /dev/`mdconfig -a -t vnode -f discimg.iso` /cdrom Solaris mkdir -p /cdrom/unnamed_cdrom ; mount -F hsfs -o ro `ls -al /dev/sr* | awk ‘{print “/dev/” $1 1}’` /cdrom/unnamed_cdrom

Solaris Files and Prompts

Solaris is a UNIX based (BSD derivative) operating system. Nativity based on Sun (SPARC) hardware, Solaris allows for high performance due to its lightweight and minimal design. Basic Configuration /etc/inittab – sets run-level (default 3, runs scripts under S, 2 and 3) /etc/init.d/ – boot scripts /etc/rc?.d/S* – links to scripts to be run on … Read more

Basic Regular Expressions (UNIX)

Basic Regular Expressions ^abc BOL abc at the beginning of the line abc$ EOL abc at the end of the line A* Any amount of characters matches any sqec or more of A`s i.e A, AAAAAA, AA, AAAAAAAAAA . Any 1 Character Any Character .* Any Characters Any Characters a[a-z0-9]c Range Between a and c … Read more

Google Advanced Search Operators

“google example” phrase Pages containing the exact phrase “google example” example  -word exclude Pages containing the word example but not the word “word” example site:www.example.com site Pages containing example within website www.example.com ~example similar Pages containing words similar to example example filetype:ppt filetype Documents containing the word example and are ppt extenstions example|google either Pages … Read more

A Look into Tcpdump

Tcpdump is a packet capture for the Linux command line. This is by no means a full guide but a quick overview of some of the main commands. The syntax below will capture all traffic with IP address of 172.16.1.1 and and IP in the network 172.16.1.0/24 with a port of udp/53. This will write … Read more

UNIX – Tcpdump

Tcpdump is a packet capture for the Linux command line. This is by no means a full guide but a quick overview of some of the main commands. The syntax below will capture all traffic with IP address of 172.16.1.1 and and IP in the network 172.16.1.0/24 with a port of udp/53. This will write … Read more

Solaris – Enabling DNS resolution (Client)

 To enable the DNS resolver client on Solaris, follow these steps, Change the line in the file /etc/nsswitch.conf that reads “hosts:     files” to hosts:      dns files Add the following line to the file /etc/resolv.conf. If the file doesnt exsist, create one. nameserver      [DNS IP]

Solaris – Sed -i work around

The version of sed on Solaris cannot actually save the file. So as a work around just type ‘perl -pi -e’ instead of the sed command : perl -pi -e ’s/who/when/g’ /tmp/afile

Common Sed Examples

Below are some of the common uses and commands for sed that I have come across over the years, Find and Replace sed -i ‘s|arp|/sbin/arp|g’ /etc/init.d/proxyarp Find and Delete sed -e ‘/^$/d’ file.txt Remove Multiple words This will remove word, word1, or word2 from the file input.txt sed ‘s/word\|word1\|word2//g’ input.txt Change the first instance on … Read more

UNIX – Add an interface Redhat / Fedora

To add a interface you need to do the following,   1. Confirm what the mac address is by running ifconfig -a  2. Then edit the relevant script , which can be found at /etc/sysconfig/network-scripts/ifcfg-eth0. The script can be ifcfg-eth1, ifcfg-eth2 etc etc.  3. And it should look something like this (for a static IP), … Read more

UNIX – TCP/IP Stack Modifications

Solaris Prevent DoS /usr/sbin/ndd -set /dev/tcp tcp_conn_req_max_q 1024/usr/sbin/ndd -set /dev/tcp tcp_conn_req_max_q0 2048/usr/sbin/ndd -set /dev/tcp tcp_time_wait_interval 60000/usr/sbin/ndd -set /dev/ip ip_respond_to_echo_broadcast 0/usr/sbin/ndd -set /dev/ip ip_forward_directed_broadcasts 0 Disable redirects /usr/sbin/ndd -set /dev/ip ip_ignore_redirect 1/usr/sbin/ndd -set /dev/ip ip_send_redirects 0 Disable Source routing /usr/sbin/ndd -set /dev/ip ip_forward_src_routed 0 Linux Kernal 2.2 Prevent DoS /sbin/sysctl -w net.ipv4.tcp_max_syn_backlog=1280/sbin/sysctl -w net.ipv4.vs.timeout_timewait=60/sbin/sysctl -w net.ipv4.icmp_echo_ignore_broadcasts=1 … Read more

UNIX – IP Forwarding

IP forwarding is the process of forwarding packets from one network to another. Below shows the necessary steps to enable/disable IP forwarding. Solaris Enable IP Forwarding ndd -set /dev/ip ip_forwarding 1 Disable IP forwarding ndd -set /dev/ip ip_forwarding 0 Check the status ndd -get /dev/ip ip_forwarding Linux Kernel If the output is 1 IP forwarding … Read more

UNIX – Process State Codes

O – On processor — the process is executing on the CPU in either user or system mode. R – Runnable — the process is on a run queue and is running or runnable. S – Sleeping — the process is waiting for a I/O event to complete. Z – zombie — process, terminated but … Read more

Solaris – Configuring an Interface

In this example we will configure interface qfe1 with the an IP of 192.168.1.1 255.255.255.0 and set the speed to 100 full duplex. Bring up the Interface To bring up and plumb the interface, we first need to type the following, (change the IP to yours) ifconfig qfe1 plumbifconfig qfe1 192.168.1.1 netmask 255.255.255.0 up Update … Read more

UNIX – Mounting a partition in Linux

In order to mount a hard drive we need to add an entry to the file /etc/fstab. This entry will allow us to not lose our drive mounting after a system reboot. /dev/sdb1       /mypartition       ext3    defaults        0       0 Then to action the changes run the following command, root@server:/# mount -a Finally check that the drive … Read more

UNIX – Recursive Grep

Below will grep for all files containing the word ssh at the beginning of the line. The BOL symol is ^.  grep -r ^ssh /etc

UNIX – Syslog – Quick Guide

Here’s a quick overview of Syslog, there’s much more to it and you can find tons more information in the links at the bottom of the page. Syslog stands for the System Log protocol. It allows for the sending and receiving of event messages and alerts across an IP network. Operating on either UDP or … Read more

Solaris – How to add a route

To add the route, use the following syntax, /usr/sbin/route add host [destination ip] [via ip] Then add this as well to your routes script (so it survives a reboot) in the /etc/rc?.d, i normally just do a find for the routes file in /etc. find /etc -name *routes*   If there isnt one then you will … Read more

Want to become a UNIX expert?

Here is our hand-picked selection of the best courses you can find online:
UNIX Administration Fundamentals
Vim Masterclass
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial