Linux.com

Home Linux Community Forums Software Command Line Share your best command line scripts

Share your best command line scripts

Link to this post 21 May 09

#! /bin/bash

exe=`basename $1 .c`
gcc $1 -o $exe

Will compile source.c and the output file will be source.
I use it along with a bash alias.

Link to this post 25 May 09

Script to upload your screenshot to my screenshot gallery

http://kporter.homelinux.com/~kaleb/screenup.sh

usage:

./screenup.sh filename.jpg

script to set your wallpaper no matter what

http://kporter.homelinux.com/~kaleb/setwall.sh

usage:

./setwall.sh filename.jpg

Link to this post 25 May 09

Here is mine:

http://omploader.org/vMXE0Zw/permfix.sh

this script is used to change all the permissions on a directory tree: it is possible to set different permissions for regular files and folders. So for example I use it for my "Music" folder:

./permfix.sh -f 640 -d 750 $HOME/Music

in this way I have the right permissions for the files and folders (the latter need a +x for "browse permission").

There is also a "pretend mode" in which the scripts just prints what it would have done in "standard mode" without actually touching any file.

Use it at your own risk. :)

Link to this post 03 Jun 09

#!/bin/bash
#test ulimit
me=/tmp/me
doit ()
{
/bin/sh $me
}
echo foo ; doit
exit 0

Link to this post 31 Jul 09

http://www.tuxopia.net/Script_to_Download_lyrics_from_command_line

My Script to Download Lyrics in Command Line as Plain Text.

Link to this post 05 Jan 10

filenames="file1 file2 file3 file4 file5 file6 file7"


target="everything" # target filename for full ZIP archive + .zip
searchdb="search-database" # target filename for search db ZIP archive

newestfile="$(ls -t *xml | head -1)"

if [ $newestfile -nt $target.zip ] ; then
# time to rebuild the archive
zip $target *xml
fi

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board