Tag Archives: bash

One Line Linux Command to Print Out Directory Tree Listing 4

My professor sent us this little one liner (ok, I had to format it to 2 lines to fit in this blog. You know what I mean) which prints out the current directory tree:
ls -R | grep “:$” | sed -e ’s/:$//’ -e ’s/[^-][^\/]*\//–/g’ \
-e ’s/^/ /’ -e ’s/-/|/’
What’s going on here?

One Line Batch Rename Files Using CSV Input File and awk 3

The Bash command environment, which is the namesake of this blog, is very flexible in that it allows you to manipulate the filesystem in many ways. Awk and sed are very powerful tools that allow you to do this rename with a simple one line command. This post will walk you through doing this with [...]

Set Operations Using Bash Commands 2

Found a great post over at good coders code, great reuse. This one deals with performing operations on sets using only unix (bash) command line operations on files of text.
* Set Membership. Test if an element belongs to a set.
* Set Equality. Test if two sets [...]

Bash Script to Interface with Rsync Command 1

I created this Bash script as a project for the system administration course I’m taking for the summer. I’m sure there are bugs in it, so let me know if you find any.
It basically uses an XML configuration file, which includes the source, destination, and any excludes from the transfer. You then pass either -u [...]

Prompt to confirm copy even with cp -f? 3

Wow – I get so frustrated when I try to copy some files over old ones and I get:
[root@server1 wordpress]# cp -Rf * ../public_html/
cp: overwrite `../public_html/license.txt’? y
-R is recursive, but -f is supposed to copy over without confirmation. What could it be?!
Check out your alias command using ‘alias’:
[root@server1 wordpress]# alias
alias cp=’cp -i’
Sure enough – alias [...]