How to get the brand and model of your graphics card with the command line.

This command will print out the model and make of your graphics card. This is another command to run on an unknown computer to see what hardware is in it. jason@eyjafjallajkull:~$ lspci -vnn | grep VGA -A 12 | head -n 1 01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Turks XT [Radeon … Read more

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