Using the Linux stat command to get information about a file.

The Linux stat command allows information to be shown about a file on your file-system. jason@darknet:~/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 … Read more

How to use the ip command to bring down an interface on RHEL.

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. [root@localhost jason]# ip link set eno16777736 down [root@localhost jason]# … Read more

Use the netdiscover command to find hosts on your local LAN.

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. jason@darkstar:~$ sudo netdiscover -r 192.168.0.1/24jason@darkstar:~$ sudo netdiscover -r 192.168.0.1/24 Currently scanning: Finished! | Screen View: Unique Hosts   … Read more

How to convert a Wikipedia article to a text file using the Linux command line.

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: jason@darkstar:~/Documents$ sudo apt-get install wikipedia2textjason@darkstar:~/Documents$ sudo apt-get install wikipedia2text Then convert an article this way. jason@darkstar:~/Documents$ wikipedia2text Debian > Debian.txtjason@darkstar:~/Documents$ wikipedia2text Debian > Debian.txt … Read more

List files by modification date with the ls command on Linux.

This one-liner will list all files in a directory by modification time, newest first. jason@eyjafjallajkull:~/Pictures$ ls -thuljason@eyjafjallajkull:~/Pictures$ ls -thul Use it this way to list the top 20 files listed. jason@eyjafjallajkull:/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 … Read more

Another way to get the IP address of your machine with the arp command.

This command will lookup the network adapter that you are using and return the gateway IP address. jason@eyjafjallajkull:~$ arp -n | grep : | awk ‘{print $1}’ 10.10.0.1jason@eyjafjallajkull:~$ arp -n | grep : | awk ‘{print $1}’ 10.10.0.1 This looks for the : character that is in the MAC address like this. jason@Yog-Sothoth:~$ arp -n … Read more

A good utility for finding all executables in a given path.

Finding all executables in a given path is easy if you use the lsx utility. Firstly install the required packages. jason@eyjafjallajkull:~$ 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 … Read more

How to send a message to logged on users on your Linux system with a simple command.

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. ubuntu@ip-172-31-20-234:~$ sudo ps … Read more

How to find a file with the Linux command line.

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. knoppix@Microknoppix:~$ sudo find /proc -name "meminfo" /proc/meminfoknoppix@Microknoppix:~$ sudo find /proc -name "meminfo" /proc/meminfo Use the -maxdepth parameter to only search a certain number of levels deep into … Read more

Some very useful Gentoo Linux tips for using the emerge command to install software.

The emerge -atv emacs command will tell you what packages will be merged when installing a copy of Emacs on your Gentoo GNU/Linux system. ec2-user@ip-172-31-30-35 ~ $ sudo emerge -atv emacs   * IMPORTANT: 8 news items need reading for repository ‘gentoo’. * Use eselect news to read news items.     These are the … Read more

New Windows package manager available in Powershell 5.0 This is quite revolutionary.

There is a new package manager available for Windows 8.1, this allows the installation of Windows software with the Powershell command line. Windows PowerShell Copyright (C) 2014 Microsoft Corporation. All rights reserved. PS C:\WINDOWS\system32> Install-Package -name Chrome WARNING: Skipping package provider provider ‘NuGet’– missing required option ‘Destination’ The package ‘xChrome’ comes from a package source … Read more

How to change the shell for a user on a Linux system easily with the usermod command.

I recently created a new user with the adduser command. homer@deusexmachina:~/Documents$ sudo adduser jimkirk Adding user `jimkirk’ … Adding new group `jimkirk’ (1002) … Adding new user `jimkirk’ (1002) with group `jimkirk’ … Creating home directory `/home/jimkirk’ … Copying files from `/etc/skel’ … Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully … Read more

How to see free memory on a Linux machine with the free command.

The free command in Linux is used to show the amount of free memory in Linux. The example below shows the default usage of this command. ubuntu@ip-172-31-0-140:~$ free total used free shared buffers cached Mem: 602736 294680 308056 16928 17632 146320 -/+ buffers/cache: 130728 472008 Swap: 0 0 0ubuntu@ip-172-31-0-140:~$ free total used free shared buffers … Read more

The mtr command for Linux. Another way to trace network hops using the command line.

The mtr command for Linux is another good way to trace network hops. Use it like this: mtr –report [HOST] homer@deusexmachina ~ $ mtr –report yahoo.com Start: Mon Jul 28 07:42:16 2014 HOST: deusexmachina Loss% Snt Last Avg Best Wrst StDev 1.|– 192.168.100.1 0.0% 10 0.3 0.3 0.3 0.4 0.0 2.|– 185.3.148.122.network.m2c 0.0% 10 29.0 … Read more

Get information about your network interface with Linux.

Linux has quite a few commands for finding out information about your network adapters. Below is an example. Using the ethtool command as root. homer@deusexmachina ~ $ sudo ethtool eth2 [sudo] password for homer: Settings for eth2: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Supported pause frame use: No … Read more

How to update the grub menu manually on Kali Linux.

The update-grub command will update the grub menu on Kali Linux. root@kali:~# update-grub Generating grub.cfg … Found background image: /usr/share/images/desktop-base/desktop-grub.png Found linux image: /boot/vmlinuz-3.12-kali1-amd64 Found initrd image: /boot/initrd.img-3.12-kali1-amd64 Found memtest86+ image: /boot/memtest86+.bin Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin No volume groups found doneroot@kali:~# update-grub Generating grub.cfg … Found background image: /usr/share/images/desktop-base/desktop-grub.png Found linux image: /boot/vmlinuz-3.12-kali1-amd64 Found … Read more

Some useful Linux commands and tricks for the bash shell user.

The boxes utility for Linux allows you to render an ascii text box around text. Below is an example. homer@homer-eME730 19:14:21 ~ $ echo `echo "This is a sentence printed to the terminal."` | boxes /***********************************************/ /* This is a sentence printed to the terminal. */ /***********************************************/homer@homer-eME730 19:14:21 ~ $ echo `echo "This is a … Read more

Using tcpdump to capture packets with a wireless connected computer.

Use this command to capture packets with the tcpdump command. This will output to STDOUT, but you may use redirection to divert it to a text file. [root@deusexmachina homer]# tcpdump -i wlp2s0[root@deusexmachina homer]# tcpdump -i wlp2s0 This is the output that you get when you are capturing packets. This is on my home network, so … Read more