C code that will select a random word from an array and include it in a string.

This code will pick a random word from the x[] array and include it in the printed string. This program will also get your current Linux username to customize the output. I am sure this code would be very useful to someone who wants to know how to handle arrays in C. #include <stdio.h> #include … Read more

How to format a partition in Linux. This is very easy.

Formatting a partition in Linux is very easy when you use the mkfs command. In this example I am formatting a 35 gigabyte partition with an EXT4 file-system. I am intending to try out a Linux From Scratch build and I want to have a dedicated partition to build this on. jason@eyjafjallajkull:~/Documents$ sudo mkfs.ext4 /dev/sdb2 … Read more

C code that will open a file and print the contents to the terminal.

This code will print the contents of a file to the terminal. Feel free to use this in your own projects if you wish. #include <stdio.h>   #define MEM "/proc/diskstats"   int main (void) {   FILE *g; char Meminfo[40]; g = fopen(MEM, "r"); if(!g) { printf ("Sorry, I cannot open: %s.\n", MEM); } else … Read more

How to delete a directory on Linux.

Deleting a directory on Linux is very easy indeed. The rmdir command will perform this task adequately. You could also use the rm -rf abc/ command to delete a directory, but rmdir is easier to remember. eyjafjallajkull% rmdir abceyjafjallajkull% rmdir abc The rmdir command will not be able to delete a directory that is not … Read more

Stealth Linux code that can run on a machine and open a port invisibly.

This code that I found: http://paste.scratchbook.ch/view/6f74b58f can run on a Linux machine and open a port invisibly. This allows access to a Linux server without the process showing in process manager and on a port scan of the machine. This might be controversial thing to post on a Linux focused website, but this might be … Read more

Some useful bash shell scripts for the Linux user.

This function will allow your computer to speak. function shellspeak() { mplayer "http://translate.google.com/translate_tts?tl=en&q=$(echo $@ | sed ‘s/\s/+/’)" > /dev/null 2>&1; }function shellspeak() { mplayer "http://translate.google.com/translate_tts?tl=en&q=$(echo $@ | sed ‘s/\s/+/’)" > /dev/null 2>&1; } A script that will change all files in a directory to lowercase filenames. function lowercase() # move filenames to lowercase. { for … Read more

How to upgrade a single package if needed using apt.

This command will update a single package upon request. This would be very useful if you want to update only one critical package on a Debian system. dpkg -s <package> 2>/dev/null | grep -q Status.*installed && sudo apt-get install <package>dpkg -s <package> 2>/dev/null | grep -q Status.*installed && sudo apt-get install <package> I found this … Read more

Ubuntu 9.10 Human theme for GTK 3.0

This is a good theme for your modern Ubuntu or Linux Mint desktop, a version of the Human theme for GTK 3.0: http://gnome-look.org/content/show.php?content=164227. This is a perfect theme to make your Ubuntu desktop look like the old Ubuntu 8.10 releases. Here is another lovely GTK 3.0 theme, Dorian: http://gnome-look.org/content/show.php/Dorian+Theme?content=157200. A collection of old Ubuntu wallpapers: … Read more

How to shutdown your Linux system properly with the command prompt.

The shutdown command for Linux and UNIX is used to shutdown your Linux system properly. This command will bring down the system immediately. shutdown -h nowshutdown -h now This will shut down the system in 60 minutes. shutdown -h +60shutdown -h +60 Use this command to reboot the computer immediately. shutdown -r nowshutdown -r now … Read more

Some useful tips for Linux Mint users.

To open a new virtual terminal to enter commands, use the Ctrl-Alt-F2 key combination and enter your username and password. This is a virtual terminal where you can control your system with a distraction free full-screen terminal. There are key combinations to switch between virtual terminals, read more here: http://www.tldp.org/LDP/GNU-Linux-Tools-Summary/html/virtual-terminals.html. To get a version of … 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

Sony pictures servers compromised and files stolen.

Sony pictures serves were recently hacked and some files were stolen. Apparently, there was a single folder named “Passwords” and this contained all of the files that were stolen. Apparently a DVDrip of the movie Fury was downloaded as well as countless passwords and other files. 47,000 social security numbers for various Hollywood stars including … Read more

Create a cool looking clock in your terminal.

This simple little script will print an updating clock in the terminal. #!/bin/sh   watch -t -n 1 ‘date +%H:%M:%S | figlet’#!/bin/sh watch -t -n 1 ‘date +%H:%M:%S | figlet’ This version will print a cow that tells you the time. #!/bin/sh   watch -t -n 1 ‘date +%H:%M:%S | cowsay’#!/bin/sh watch -t -n 1 … Read more

More useful bash tricks for navigating your filesystem.

Navigating the Linux filesystem is very easy. The cd command is used to move to another directory. But there are other ways too. To navigate back to the last directory you were in, type cd -. This will take you back to where you were before. ubuntu /usr/share $ cd – /home/ubuntuubuntu /usr/share $ cd … Read more

Useful web page for generating sources.lst files for Ubuntu with a simple interface.

This web page allows a user to generate a sources.lst file for an Ubuntu distribution. repogen.simplylinux.ch is a site that allows you to recreate your sources.lst if it is deleted accidentally. This would be very useful for a person that needs this kind of service in a hurry. So, check this site out and see … Read more