How to Find Large Files in Ubuntu Linux

If you want to find files above a certain size, or find files between certain sizes, then you may use the +size x and -size x switches to the find command.

For example:

find /etc -size +100k -size -150k

This command will find all files inside the /etc directory that are between 100k and 150k in size.

Source: http://www.unixtutorial.org/2008/03/find-large-files-and-directories/

Posted under Linux

This post was written by Content Curator on May 25, 2011

Tags: , , , , , , , , ,

How to Make a Backup Script for Shell in Linux

For those who hack a lot of Linux at the command line interface, backing up files such as config files before editing is a good habit to have. IMHO anyway. So to save time, a little script can be written, chmod +x, and placed into /usr/local/bin or some other that users have in their executable shell PATH. I name mine “bu” to make it easy, and it takes one command line argument which is the filename of the file you want to make a backup copy of. It is called by running something like $ bu myfile

Here’s the code. Comments welcome ;) The code creates a timecode based on today’s date and the current time to the second, and appends that to the original filename. The a copy is saved with this new “timestamped” backup filename, right in the same directory. Easy-peasy! 

#!/bin/bash
OLDFILENAME=$1
DATECODE=$(date +%Y%m%d)
TIMECODE=$(date +%H%M%S)
NEWFILENAME="${OLDFILENAME}_backup${DATECODE}-$TIMECODE"
cp $OLDFILENAME $NEWFILENAME
SUCCESS=$?
if [ $SUCCESS -eq 0 ];then
 echo "OK! Copied \"$OLDFILENAME\" to \"$NEWFILENAME\""
else
 echo "FAIL! You'll need to try again!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
fi

Posted under Linux

How to Show MySQL Warnings at CLI

When logged in to the MySQL server using the command line interface (CLI) the  generated errors on the previously run command.

mysql> show warnings;

Thanks to Trevor Nichols and www.issociate.de

Posted under Freeware, MySQL

This post was written by Content Curator on November 16, 2009

Tags: , , , , , , , , , , , ,

Windows XP Service Pack 3 Command Line Options

When running the SP3 install from the command line, choose the following options:

---------------------------
Service Pack 3 Setup
---------------------------
AVAILABLE SWITCHES:
[/help] [/quiet] [/passive] [/norestart] [/forcerestart] [/warnrestart] [/promptrestart] [/overwriteoem] [/nobackup] [/forceappsclose] [/integrate:] [/d:] [/log:]

/help Displays this message

SETUP MODES

/quiet Quiet mode (no user interaction or display)
/passive Unattended mode (progress bar only)

RESTART OPTIONS

/norestart Do not restart when installation is complete
/forcerestart Restart after installation
/warnrestart[:] Warn and restart automatically if required (default timeout 30 seconds)
/promptrestart Prompt if restart is required

SPECIAL OPTIONS

/overwriteoem Overwrite OEM files without prompting
/nobackup Do not backup files needed for uninstall
/forceappsclose Force other programs to close when the computer shuts down
/integrate: Integrate this software update into
/d: Back up files into
/log: Create log file at

****
My Install
Command line:
D:\WindowsXP-KB936929-SP3-x86-ENU /nobackup /quiet /forcerestart /forceappsclose

Posted under Microsoft

MySQL login with command line (CLI)

# mysql -h hostname -u username -p

It will prompt you for the password.

Then:

> connect dbname

Posted under MySQL

This post was written by Content Curator on September 17, 2007

Tags: , , , , , , , ,

Map a local folder as a new Drive letter

At the command prompt:

subst x: C:{pathname}foldername}

Posted under Uncategorized

This post was written by Content Curator on May 12, 2007

Tags: , , , , , , , ,