cdargs – bash cd command with bookmarks and browser.

\"Screenshot
Image via Wikipedia

cdargs is a bash shell cd with bookmarks and browser. Quite useful if you are developer or someone who use\’s the bash shell very frequently

Name       : cdargs
Arch       : i686
Version    : 1.35
Release    : 5.fc12
Size       : 114 k
Repo       : installed
From repo  : fedora
Summary    : The shell cd with bookmarks and browser
URL        : http://www.skamphausen.de/software/cdargs/
License    : GPLv2+
Description: Enables the user to quickly change working directory by navigating cd arguments
           : and expanding the shell built-in cd with bookmarks and browser.

You can check the man page with man cdargs to get more details about the command. And if you don\’t have it installed and still you want to check out the man page then click cdargs man page.

Its quite easy to use and would save you a lot of typing and the man page describes it all 🙂

\"Reblog

The power of find command in Linux – advanced.

Generally whoever uses Linux, would know about the find command. Find the man page here.

There are also lots of blogs, tutorials and other articles on find command on the web, so why write another one. Because it\’s worth every word spent on it 🙂
find is a very powerful command, let\’s see how (options for find command from man page and usage):

depth — Process each directory\’s contents before the directory itself.
maxdepth — Descend at most levels (a non-negative integer) levels of directories below the command line arguments.
xdev — Don\’t descend directories on other filesystems.
executable — Matches files which are executable and directories which are searchable (in a file name resolution sense).
This takes into account access control lists and other permissions artefacts which the -perm test ignores.
iname — Like -name, but the match is case insensitive.
nogroup — No group corresponds to file\’s numeric group ID.
nouser — No user corresponds to file\’s numeric user ID.
fls file — True; like -ls but write to file like -fprint.
ok command — Like -exec but ask the user first (on the standard input);
print0 — True; print the full file name on the standard output, followed by a null character
(instead of the newline character that -print uses).
printf format — True; print format on the standard output, interpreting \’\’ escapes and \’%\’ directives.

There are lot of other options but these are worth mention not used on regular basis. The printf option requires
special mention as the number of options that it supports is quite large and can reallyl help you in the formatting
the data that you get, as well as help you get the data that you want.

Example:
1) Get names of files bigger than 5M

find . +5M -printf \”Name : %20f Size : %s\\n\”

2) delete files (filenames contain spaces or quotes and so on)

find . -name \”name*\” -print0 |xargs -0 rm -f

Updated 28th May: Realinged for issues with post going into the sidebar 🙁

coproc help – a new feature in bash

\"Screenshot
Image via Wikipedia

In the bash version 4.0, there is a new concept called coproc. This is very useful for some of the daily tasks.

co-process starts a process in the background, optionally with a NAME, with which other processes can communicate. This can be a very good substitution for pipes in lots of cases. You can learn more about coproc in the link below:

The coproc keyword [Bash Hackers Wiki]

From the man page for bash:
Coprocesses
A coprocess is a shell command preceded by the coproc reserved word. A
coprocess is executed asynchronously in a subshell, as if the command
had been terminated with the & control operator, with a two-way pipe
established between the executing shell and the coprocess.

The format for a coprocess is:

coproc [NAME] command [redirections]

This creates a coprocess named NAME. If NAME is not supplied, the
default name is COPROC. NAME must not be supplied if command is a sim-
ple command (see above); otherwise, it is interpreted as the first word
of the simple command. When the coproc is executed, the shell creates
an array variable (see Arrays below) named NAME in the context of the
executing shell. The standard output of command is connected via a
pipe to a file descriptor in the executing shell, and that file
descriptor is assigned to NAME[0]. The standard input of command is
connected via a pipe to a file descriptor in the executing shell, and
that file descriptor is assigned to NAME[1]. This pipe is established
before any redirections specified by the command (see REDIRECTION
below). The file descriptors can be utilized as arguments to shell
commands and redirections using standard word expansions. The process
id of the shell spawned to execute the coprocess is available as the
value of the variable NAME_PID. The wait builtin command may be used
to wait for the coprocess to terminate.

\"Reblog