The type command for bash will tell you whether a command is a shell built-in or an executable on it`s own. This is very simple to use. This example shows how it works. [email protected]:~$ type -a echo echo is a shell builtin echo is [email protected]:~$ type -a echo echo is a shell builtin echo is …

Embedding the output of a command into a bash shell script is quite easy. Here is an example. echo “Hello $(whoami), the date is $(date -u). Have a nice day” This is the output this will give you. ┌─[[email protected]]─[~] └──╼ $echo “Hello $(whoami), the date is $(date -u). Have a nice day.” Hello jason, the …

To update the grub bootloader on your Linux box, this is another way to do this. grub-mkconfig > /boot/grub/grub.cfg This will update the grub2 bootloader and add any new kernels in /boot. Creating a new swapfile for your Linux system. Firstly we create a new file padded with zeros from /dev/zero. [email protected]:~# dd if=/dev/zero of=swafile …

This command will show how many kilometers there are in a light year. jason$ units -t ‘1 light year/kilometers’ 9.4605284e+12jason$ units -t ‘1 light year/kilometers’ 9.4605284e+12 If I travelled 800m in 9.58 seconds how many miles per hour is this? jason$ units -t ‘800m/9.58s’ ‘miles/hour’ 186.80053jason$ units -t ‘800m/9.58s’ ‘miles/hour’ 186.80053 Using it this way, …

The Linux find command is useful for finding files on your Linux system. It is possible to look for more than one file type. This example will search for all text and png files under the /usr/share directory. [email protected]:/usr/share$ find -regex ‘.*txt\|.*png’[email protected]:/usr/share$ find -regex ‘.*txt\|.*png’ This example will search for three different file types. [email protected]:/usr/share$ …

This command will return a huge listing of all the visitable url`s on the http://www.google.com.au website. Give this a shot on other websites and see how you go. [email protected]:~$ wget –spider –force-html -r -l2 http://www.google.com.au 2>&1 | grep ‘^–‘ | awk ‘{ print $3 }’[email protected]:~$ wget –spider –force-html -r -l2 http://www.google.com.au 2>&1 | grep ‘^–‘ …

To get the command line of a process without the ps command, and the PID of the command is known, use this command. This example is using a process with a PID of 3380. [email protected]:~$ cat /proc/3380/cmdline /usr/lib/vmware/bin/thnuclnt-pdir/tmp/vmware-jason/thnuclnt-3346-[email protected]:~$ cat /proc/3380/cmdline /usr/lib/vmware/bin/thnuclnt-pdir/tmp/vmware-jason/thnuclnt-3346-fg This will show the command line of the process without using the ps command. …

The Linux stat command allows information to be shown about a file on your file-system. [email protected]:~/Documents$ stat /bin/ls File: ‘/bin/ls’ Size: 118280 Blocks: 232 IO Block: 4096 regular file Device: 801h/2049d Inode: 10616940 Links: 1 Access: (0755/-rwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2016-02-01 08:55:40.145487505 +1100 Modify: 2015-03-15 02:47:04.000000000 +1100 Change: 2016-01-19 …

The ip command is a useful alternative to the ifconfig command and allows the user to manage network interfaces. This is a good way to use the command line to bring network interfaces up or down. In this example I am bringing the network interface down. [[email protected] jason]# ip link set eno16777736 down [[email protected] jason]# …

The netdiscover utility will list all connected hosts on your local LAN. This is useful for scanning a network and determining which hosts are online. I used this command to scan an IP range starting with 192.168.0.1. [email protected]:~$ sudo netdiscover -r [email protected]:~$ sudo netdiscover -r 192.168.0.1/24 Currently scanning: Finished! | Screen View: Unique Hosts   …

The wikipedia2text command allows a command line user on Debian to output the contents of a Wikipedia article to a text file on your hard drive. Install this command this way: [email protected]:~/Documents$ sudo apt-get install [email protected]:~/Documents$ sudo apt-get install wikipedia2text Then convert an article this way. [email protected]:~/Documents$ wikipedia2text Debian > [email protected]:~/Documents$ wikipedia2text Debian > Debian.txt …

This one-liner will list all files in a directory by modification time, newest first. [email protected]:~/Pictures$ ls [email protected]:~/Pictures$ ls -thul Use it this way to list the top 20 files listed. [email protected]:/var/log$ ls -thul | head -n 20 total 6.9M -rw-rw-r– 1 root utmp 9.0K Jul 9 11:30 wtmp -rw-r–r– 1 root root 85K Jul 9 …

This command will lookup the network adapter that you are using and return your network address. [email protected]:~$ arp -n | grep : | awk ‘{print $1}’ [email protected]:~$ arp -n | grep : | awk ‘{print $1}’ 10.10.0.1 This looks for the : character that is in the MAC address like this. [email protected]:~$ arp -n Address …

Finding all executables in a given path is easy if you use the lsx utility. Firstly install the required packages. [email protected]:~$ sudo apt-get install suckless-tools [sudo] password for jason: Reading package lists… Done Building dependency tree Reading state information… Done Suggested packages: dwm stterm surf The following NEW packages will be installed: suckless-tools 0 to …

The wall command is a perfect way to send a message to all logged on users on a Linux machine. This is used when you shutdown to alert all users that the system will be shutting down. The example below shows me sending the output of the ps command to all users. [email protected]:~$ sudo ps …

The Linux command line is very useful for finding files, the find command is the best way to locate files on your filesystem. This is a simple example. [email protected]:~$ sudo find /proc -name "meminfo" [email protected]:~$ sudo find /proc -name "meminfo" /proc/meminfo Use the -maxdepth parameter to only search a certain number of levels deep into …