Adams Bros Blog


Linux Disk Usage Exclude Dot Directories

Posted by Trenton

I'm always searching for how to do this because I keep forgetting. So here it is, no more searching.

Filed under: Bash, Linux Continue reading

Backups Made Simple

Posted by Trenton

I've had complex backup solutions in the past, which I wrote myself with rsync and bash.  I've recently got sick and tired of the issues that come up now and then with them, so I decided to keep it extremely simple. So, I decided to opt for a couple of rsync only shell scripts. I get emails every time they run, as part of cron.

Filed under: Bash, Linux Continue reading

Save Bash History Realtime

Posted by Trenton

I kind of get sick of my work computer dying, and then I lose some history because I forgot to exit my terminal sessions.  I've always used the histappend feature, but this prompt command thing is great. 😀  Thank you Stack Exchange.  The other benefit of this is that each terminal immediately receives the new history next time you press enter.

Filed under: Bash Continue reading

Compress All Log Files

Posted by Trenton

I decided to start being more active with this blog.  I've always wanted a personal indexer for all the things I learn in Linux or software development.  Might as well make this blog that index.

So, you want to gzip all the log files in a particular directory right?  Well, you better be sure that you're not doing that to live files, so just check them with lsof...

find /var/log/somefolder -type f | while read -r file; do lsof "$file"; if [ $? -eq 1 ]; then gzip "$file"; fi; done
Filed under: Bash, Linux No Comments

Removing spaces from filenames

Posted by Trenton

If you use bash under unix, Linux, or Mac OS X, and you're continually forgetting how to convert filenames with spaces to filenames without spaces, then look no further.

Filed under: Bash, Linux Continue reading