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. [email protected]:~$ sudo ps […]


Read more...

More useful bash tricks for navigating your filesystem.

To navigate back to the last directory you were in, type cd -. This will take you back to where you were before. The cd ~ command will take you back to your home directory. The user can also use the cd command by itself to go back to the home directory. Using cd .. […]


Read more...

How to change the default shell for new users on your Ubuntu Linux system.

The useradd command is used to add new users on your Linux system. But it can be used for other things too. You may display the defaults for new users. jason-H55-USB3% sudo useradd -D GROUP=100 HOME=/home INACTIVE=-1 EXPIRE= SHELL=/bin/sh SKEL=/etc/skel CREATE_MAIL_SPOOL=no Use the -s parameter to useradd and this will change the default shell for […]


Read more...

A variant of the shellshock bug that still works with the bash 4.3.11 shell.

This is a variant of the shellshock bug for bash that still works on a patched system. I am using Ubuntu 14.04 and this still works for me. env VAR1=’me() {echo "hello"}\ ‘ /bin/touch /home/$LOGNAME/my.text So you can still put arbitrary content after the function definition in a bash script. I have installed the latest […]


Read more...

How to list all files in a directory that are larger than one megabyte.

Use this command to find all files in a directory that are larger than 1 megabyte. find . -maxdepth 1 -type f -size +1M -exec ls -Shal {} \+ | head Here is this command in practice. This is a very useful command. [email protected]:/boot$ find . -maxdepth 1 -type f -size +1M -exec ls -Shal […]


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. [email protected]:~/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 print out a list of all BBC news headlines with the command line. This is very cool.

This simple one-liner will print out all of the news headlines from the BBC news website in a simple text format. This is useful if you want to do something with a list like this. Or if you just want a listing to see if there is anything interesting happening. [email protected]:~$ curl -s http://feeds.bbci.co.uk/news/rss.xml | […]


Read more...

A useful script for gaining information about your Ethernet adapter.

This useful shell script will print information about your Ethernet or Wireless adapter. This is very useful for getting a lot of information at once. #!/bin/sh   DEV="eno16777736"   echo "Showing information for the active network interface: $DEV."   echo -e "-*- \e[1mGet timestamping information for your Ethernet device.\e[0m -*-" echo   ethtool -T $DEV […]


Read more...

Some useful Linux scripts for the desktop Linux user who likes the command line.

There are many useful Linux tips that make the life of a Linux user much easier. One is for the VI or VIM editor. To open a file at a specific line; use this command. [email protected] ~/Documents/yadex-1.7.901 $ vim src/x11.h +33 This will open the file x11.h at line 33. How to ssh into a […]


Read more...

How to copy files from one machine to another using SSH and the sftp command.

The sftp command allows a user to retrieve files on a remote machine and save them on their computer. Use this command to access the files: sftp -P 443 [email protected]:/home/homer/Downloads/*.pdf I have my SSH server running on port 443, so I need to specify that port when using this command. I am using Cygwin on […]


Read more...

Useful shell script that may be used to create a whole host of user accounts easily.

This bash shell script is useful for creating a new user and setting a password for that user. This allows you to just type a username and password and everything else is done for you. Very useful for someone who is in a hurry. #!/bin/bash   echo "Type a username for your new account: " […]


Read more...

How to use the touch command to create a file with an arbitrary filename.

The touch command ordinarily does not allow the user to create files with a filename like –rf, but if you want to really annoy someone then you may use this command to create one. [email protected]:~$ touch — ‘–rf ‘ And now you have a file named –rf. -rw-r–r– 1 homer homer 0 Jun 28 16:26 […]


Read more...

A quick look at redirection in the bash shell.

The bash shell allows the user to redirect output from one application to another or to a file. This is very useful when you are building a one liner script to perform a certain action. Here is a simple redirection. ls > ls.out This redirects the output of the ls command to a file that […]


Read more...

How to change the default plymouth theme manually on Ubuntu 14.10.

Changing the default plymouth theme on Ubuntu 14.10 is not very difficult. Just type this at the shell prompt. This will set the new theme. [email protected]:~# update-alternatives –install /lib/plymouth/themes/default.plymouth default.plymouth /lib/plymouth/themes/ubuntustudio-logo/ubuntustudio-logo.plymouth 100 Now we need to save our changes. [email protected]:~# update-alternatives –config default.plymouth There are 5 choices for the alternative default.plymouth (providing /lib/plymouth/themes/default.plymouth).   Selection […]


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. [email protected] 19:14:21 ~ $ echo `echo "This is a sentence printed to the terminal."` | boxes /***********************************************/ /* This is a sentence printed to the terminal. */ /***********************************************/ This is a useful utility if you want […]


Read more...

Useful Macintosh OSX terminal commands to get information about your iMac.

The mount command shows information about your mounted partitions on your machine. iMac305:~ admin$ mount /dev/disk0s2 on / (hfs, local, journaled) devfs on /dev (devfs, local, nobrowse) map -hosts on /net (autofs, nosuid, automounted, nobrowse) map auto_home on /home (autofs, automounted, nobrowse) map -fstab on /Network/Servers (autofs, automounted, nobrowse) /dev/disk0s3 on /Volumes/Scratch (hfs, local, journaled) […]


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. [[email protected] homer]# tcpdump -i wlp2s0 This is the output that you get when you are capturing packets. This is on my home network, so there are not many […]


Read more...

More useful shell tricks for bash. These are very useful tricks for any Linux user.

This sed trick will filter out the unwanted characters and leave only the letters ‘A’. [email protected] ~ $ echo "###AAA" | sed ‘s/###//gi’ AAA This is how to re-bind the annoying CAPS-Lock key to Esc. This can give that key a new use. xmodmap -e ‘clear Lock’ -e ‘keycode 0x42 = Escape’ & Here is […]


Read more...

Some miscellaneous Linux commands for the desktop user.

Find all files larger than 1 megabyte in a directory. find . -maxdepth 1 -type f -size +1M -printf "%f:%s\n" | sort -t":" -k2 Search a file for a certain string. grep "hello" my.txt Get the hostname from an IP address. [email protected] – $ ipcalc -h 74.125.237.194/24 HOSTNAME=google.com Use wildcards on the command line to […]


Read more...

A useful posting explaining why Linux does not need defragmenting.

If you are interested in how the Linux filesystem works, then this is a posting you really need to read: http://geekblog.oneandoneis2.org/index.php/2006/08/17/why_doesn_t_linux_need_defragmenting. This is a posting explaining how the Linux filesystem stores file and why it does not need to defragment the filesystem as it stores files more efficiently. I have never wanted to defragment a […]


Read more...