You are visiting this website from: Ashburn, in United States. The date is: 2016/05/27 16:04:30.

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. ubuntu@ip-172-31-20-234:/boot$ find . -maxdepth 1 -type f -size +1M -exec ls -Shal […]

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 […]

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. john@ubuntu:~$ curl -s http://feeds.bbci.co.uk/news/rss.xml | […]

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 […]

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. homer@deusexmachina ~/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 […]

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 homer@192.168.100.2:/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 […]

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: " […]

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. homer@debian:~$ touch — ‘–rf ‘ And now you have a file named –rf. -rw-r–r– 1 homer homer 0 Jun 28 16:26 […]

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 […]

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. root@homer-eME730:~# 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. root@homer-eME730:~# update-alternatives –config default.plymouth There are 5 choices for the alternative default.plymouth (providing /lib/plymouth/themes/default.plymouth).   Selection […]

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. */ /***********************************************/ This is a useful utility if you want […]

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) […]

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

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’. homer@deusexmachina ~ $ 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 […]

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. Homer@bejiitas – $ ipcalc -h 74.125.237.194/24 HOSTNAME=google.com Use wildcards on the command line to […]