Tag:
command

Get a Listing of Directories in a Subdirectory

by
on
February 18, 2011

Here is a great little command line trick to list only the subdirectories in your current working directory. $ ls -d */

Read More
No Comments
bash

Echo text without a trailing newline

by
on
February 18, 2011

By default the echo command will include a trailing newline at the end of a string. There are many times when you may want to suppress this newline for example when you want to format text in a certain way.There are a couple easy ways to do this. First you can use the ‘-n’ option. [...]

Read More
No Comments
bash

Find the exit status of a previous command in Bash

by
on
January 14, 2011

Most programs will return an exit status of 0 if the program was successful, while a non-zero exit status usually indicates an error. You can find the exit status or exit code of the previously executed command by accessing the “$?” shell variable. $ COMMAND $ echo $? Typically when a command terminates on a [...]

Read More
No Comments
bash

Skip network filesystems when searching with find

by
on
January 19, 2009

When you run the find command on the root directory of a system you may want to exclude all network filesystems and confine your search to only your local machine. The benefits of this are obvious as it will save you a great amount of time especially if the mounted filesystem is very large. Luckily [...]

Read More
1 Comment
system administration

Command substitution in BASH

by
on
November 7, 2008

BASH has the ability to execute a command string and replace that string with the output of the command. Or to say it another way, the output of a command will replace the command itself. There are 2 ways to accomplish this. The first is to surround the command with backticks or blockquotes. `command` You [...]

Read More
No Comments
bash
Copyright 2008-2010 WiredRevolution.com. All rights reserved.