In my post from earlier this week on removing the color output from the
ls command I mentioned that in some circumstances the color-coded output can cause permissions errors. Cloned Milkmen asked that I explain why this would be.
I was hoping someone would ask that. In Linux and UNIX if the execute flag is not set on a directory, as in the example below, the
ls --color=tty command will return
$ ls -ld ls_test/
dr-------- 4 jonemmons pg222211 4096 Nov 12 20:07 ls_test/
$ ls ----color=tty ls_test/
ls: ls_test/test1: Permission denied
ls: ls_test/test2: Permission denied
ls: ls_test/test3: Permission denied
$ ls ls_test/
dir1 dir2 test1 test2 test3
The execute flag is funny on directories. The main effect is that it will inhibit a user’s ability to
cd into a directory, but it will also keep you from being able to get information out of the file’s inode (the inode contains information about when a file was created, modified, accessed etc.) Since
ls requires information from the inode to properly color-code files in a directory it will fail if the execute bit is not set. An
ls -l will fail for the same reason.
So thanks to Cloned Milkmen for asking the question. If you’re looking for some eclectic and distracting reading, check out his blog The Synthetic Librarian.
unix, linux, directory, permission, security, sysadmin, system administration
Exactly 15 months after I first posted about it my book Oracle Shell Scripting: Linux and UNIX Programming for Oracle has finally been printed and is available!
The book offers an introduction to shell scripting, an in-depth look at many useful shell commands and tools and a bunch of example scripts to use as-is or as a basis for your own custom scripts. As a long-time database and system administrator I have compiled some of the best tools, tips and tricks I have found for administration, monitoring and automation of DBA tasks.
I know you’re just dying to go out and get it, but it will probably take a couple weeks for it to hit book stores and Amazon. The best way to buy the book is directly from the publisher. They have it in stock and ready to go.
I will be posting more about the book here in the near future. It really covers a lot of what I have learned in my professional career and I’m thrilled at the opportunity to share my experience in this form. If you have questions about the book please feel free to leave a comment. I don’t always get to my comments quickly, but I do read and reply to all of them.
unix, oracle, shell scripting, linux, book, database tuning, database administration, database security
Many popular varieties of Linux use a “feature” which causes the
ls command output to show files, directories, links, etc. all in different colors. I guess some people prefer this, but I find it at best annoying, and at worst illegible. Specifically the color-coding of symbolic links tend to show in such a light color that it is often impossible to read.
The color output is accomplished by adding the
--color=tty or a similar option to the
ls command. This is typically accomplished by creating an alias to
ls in either the user’s profile or in one of the system-wide profiles.
alias ls='ls --color=tty'
My personal preference is to remove this line from any system-wide configuration files (such as
/etc/profile) and allow users to set it in their own profile if preferred. If you don’t have the desire or ability to make this change universally than a user can easily disable the color output by using the
This can either be added to the user’s configuration file (e.g. the
.bash_profile in their home directory), or you can just type
unalias ls anytime to disable color
ls output for the rest of the current shell session. This can be especially useful to turn off the color output when you’re working on someone else’s system.
ls output can cause permissions errors in some circumstances, so in my opinion it is best left off, but if you’re stuck with it then it’s nice to know how it can be disabled when necessary.
ls, sysadmin, system administration, linux, shell, bash, sh, UNIX
I make no secret of the point that I love the webcomic xkcd and if I blogged every strip I like I would basically end up mirroring the entire comic here.
With that in mind, there is no way I could pass up posting this commic:
Next time someone asks you what a SQL injection is you can point them at this, then explain nicely.
sql, oracle, pl/sql, plsql, exploit, security, sql exploit, dba, database, database administration, comic, fun, funny, sql injection
So here’s a nice little Firefox easter egg for vi users:
In Firefox (at least version 184.108.40.206 on the PC, I haven’t confirmed this on others) you can search for text by simply typing a slash (/). As long as you’re not in a text entry box the / character will open up the find dialog box just like control-f would.
For those of you who don’t understand the significance of this, in the popular UNIX command line text editor vi you search for text by typing
/string to find. This is typical of how vi works: powerful, simple commands which are rarely obvious.
vi, unix, linux, firefox, web, internet