small programs used on the command line to do a specific job
85
votes
16answers
38k views
Repeat a Unix command every x seconds forever
There's a builtin Unix command repeat whose first argument is the number of times to repeat a command, where the command (with any arguments) is specified by the remaining arguments to repeat. For ...
30
votes
2answers
6k views
What does “--” (double-dash) mean?
I have seen -- used in the compgen command.
For example:
compgen -W "foo bar baz" -- b
What is the meaning of the --.
26
votes
4answers
2k views
What is the difference between a builtin command and one that is not?
Is there any intrinsic difference between a builtin command and another command which can nominally do the same thing?
eg. Do builtins get "special" treatement? ... is there less overhead running ...
21
votes
6answers
2k views
Linux tools to treat files as sets and perform set operations on them
Does anyone know of any linux tool specifically designed to treat files as sets and perform set operations on them? Like difference, intersection, etc?
21
votes
5answers
2k views
Is there any option with 'ls' command that I see only the directories?
Sometimes, I need to check only the directories not files. Is there any option with the command ls? Or is there any utility for doing that?
EDIT: I'm using Mac OS X, and ls -d gives me . even though ...
20
votes
2answers
2k views
What is the difference between curl and wget?
I am keen to know the difference between curl and wget. Both are used to get files and documents but what the key difference between them... Why are there two different methods?
18
votes
4answers
599 views
Are Linux utilities smart when running piped commands?
I was just running a few commands in a terminal and I started wondering, does Unix/Linux take shortcuts when running piped commands?
For example, let's say I have a file with one million lines, the ...
16
votes
4answers
6k views
What is the mknod command used for?
I just started using Ubuntu as my main OS and I wanted to learn about things I should not do, and learn by the bad things people have done in the past. I came across these email about horror stories ...
13
votes
8answers
1k views
What are the best general purpose programming tools to complement Vim?
I've been using Vim as my text editor for a little while now and I feel like I'm taking the long way to do anything. I use ctags to tag my code base for navigation and I use grep (although ...
13
votes
9answers
6k views
Tool in UNIX to subtract dates
Is there any tool in Solaris UNIX (so no GNU tool available) to subtract dates? I know that in Linux we have gawk that can subtract one date from another. But in Solaris the maximum we have is nawk ...
12
votes
3answers
1k views
Why use superflous dash (-) to pass option flags to tar?
To create a tar file for a directory, the tar command with compress, verbose and file options can be typed thus:
$ tar -cvf my.tar my_directory/
But it also works to do it this way:
$ tar cvf ...
11
votes
4answers
2k views
Usage of dash (-) in place of a filename
For a command, if using - as an argument in place of a file name will mean STDIN or STDOUT.
But in this example, it creates a file with the name -:
echo hello > -
How can I make - in this ...
11
votes
2answers
823 views
Is '-9' a flag to kill command?
What does -9 do?
It does not show up in the syntax:
$ kill
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
$
11
votes
4answers
2k views
Setting the window dimensions of a running application
I'm trying to start an application within Ubuntu (xfce or gnome) and via the
command line and was wondering if there's a generic way to set the dimensions of a
given window of a given app that is ...
11
votes
2answers
215 views
`test` and `[` - different binaries, any difference?
I noticed while answering another question that test and [ are different binaries, but the [ manpage pulls up test's. Besides the requirement for an ending ], is there any difference? If not, why are ...
10
votes
1answer
329 views
What do all the pictures on the front of the “Unix and Linux System Administration Handbook” represent?
I'm a newcomer to Unix and Linux, and I've been trying to get up to speed on everything. One of the guides I've used is the "Unix and Linux System Administration Handbook"
It's a pretty great book, ...
9
votes
3answers
404 views
Doing two things with output from a command
I have a program texcount that outputs the number of words in my LaTeX document. I can also pipe the output of this to sed to make the newlines TeX linebreaks and write this to a file which I can then ...
8
votes
3answers
221 views
Universal extractors
With an increasing number of archive/compression file formats, is there a single free/open-source command line tool to rule them all? Perhaps something with a consistent / unified set of flags? (note ...
7
votes
4answers
945 views
creating a sequence of numbers, one per line in a file
Is there a way to create out of thin air, a file that is a sequence of numbers, starting at a given number, one per line?
something like
magic_command start 100 lines 5 > b.txt
and then, b.txt ...
6
votes
9answers
446 views
What is/are the standard CLI program(s) to manage users and groups?
As the title says, I'm basically asking about user management from the command line (e.g. on a system where there are no graphical tools available). In the past I've used several different programs to ...
6
votes
4answers
3k views
How can I use sed to replace a multi-line string?
I've noticed that, if I add \n to a patter for a substitute using sed, it does not match. Example:
$ cat > alpha.txt
This is
a test
Please do not
be alarmed
$ sed -i'.original' 's/a test\nPlease ...
6
votes
1answer
246 views
Is there a way to make perl -i not clobber symlinks?
A friend of mine points out that if you do:
perl -pi.bak -e 's/foo/bar/' somefile
when "somefile" is actually a symlink, perl does just what the docs say it will do:
It does this by renaming ...
5
votes
3answers
1k views
cp or rsync, is cp really worth it?
I hope this does not count as a question without a real answer, as I can't seem to find a good reason to use cp(1) over rsync(1) in virtually all circumstances. Should one typically favour rsync over ...
5
votes
1answer
121 views
How would one detect if external command exists in a script?
Is there a way to detect if an external command exists (i.e. wget, svn)?
More specifically today, i was trying to run one of my scripts i wrote and the person didn't have wget or svn installed.
The ...
5
votes
1answer
311 views
What commands have -h human readable option, and how can I enable it by default w/env variable?
I'm tired of using aliases or typing -h. I want human readable output 24/7. Is there a way to enable it all the time for all commands that offer it?
Thanks.
5
votes
1answer
279 views
Can hd and od replace each other?
hd and od are both dump viewers of binary content. Can hd be used wherever od is and vice versa?
5
votes
4answers
564 views
A standard tool to convert a byte-count into human KiB MiB etc; like du, ls1
Is there a standard tool which converts an integer count of Bytes into a human-readable count of the largest possible unit-size, while keeping the numeric value between 1.00 and 1023.99 ?
I have my ...
5
votes
1answer
298 views
How to use the ul command line utility
I wanted to answer http://unix.stackexchange.com/questions/3043/use-roff-to-underline-words with "just use ul, this command is meant specifically for underlining text", however I just can't grasp how ...
5
votes
3answers
171 views
Can a file that was originally sparse and expanded be made re-sparse
I know that copying or transferring what was originally a sparse file without using a utility that understands sparse files will cause the 'holes' to be filled out. Is there a method or utility to ...
5
votes
1answer
567 views
Are there alternatives for `dd`?
What other tools should I use to read and write files with truncation, seeking and skipping. dd's command line options seem inconvenient and foreign and I don't like choosing between slow, but precise ...
5
votes
1answer
184 views
Interactive tree command
Is there any version of tree command that displays file structure as a tree structure, but in a way that I can interactively walk trough?
Why do I need it exactly - I am trying to simulate TextMate ...
5
votes
2answers
480 views
Alternative to watch which support colors
I have a command (phpunit) which has a colored output. According to the watch, command I should be able to use the --color flag to allow color rendering to pass through. However, this isn't working. ...
4
votes
3answers
366 views
General specification for command line interface
I was wondering where I can find and
learn some general idea about the
command line interface used in Linux
and bash?
As to now, I have found pieces of
such information only from
experience, such as
...
4
votes
5answers
2k views
Alternative to find?
Is there an alternative find program with a more conventional CLI interface? find works and expects parameters in a painfully different way from most other utils.
Clarification: I'm looking for a ...
4
votes
2answers
3k views
How can I test the encoding of a text file… Is it valid, and what is it?
I have several .htm files which open in Gedit without any warning/error, but when I open these same file in Jedit, it warns me of invalid UTF-8 encoding...
The html meta tag states ...
4
votes
2answers
161 views
What are all the items on the cover of the “Linux Administration Handbook”?
As I mentioned in What do all the pictures on the front of the "Unix and Linux System Administration Handbook" represent? I'm fairly new to Linux and Unix.
@jasonwryan provided an excellent ...
4
votes
1answer
296 views
Difference between references of Linux “utilities”, “commands” and “programs”
I read uses of the word "utilities" for commands/programs such as 'ls', 'chmod', 'mv', etc.
Is "commands" is Linux referring to the same things as top, ps, etc., or are those something different? ...
4
votes
3answers
222 views
Monitor directory and if a file is requested then rsync on demand
Is there a tool that monitors a certain directory and if a program tries to access a file in that directory, the program loads that file from another place transparent for any application that tries ...
4
votes
2answers
835 views
Combine input from multiple files/pipes without clobbering lines or blocking?
Is there a tool that will take input from multiple files or pipes and write it to stdout, without blocking on reads, such that individual input lines come out intact? I basically want to multiplex a ...
4
votes
1answer
28 views
Determine monthly internet transfer to detect right FUP
I live in a country where many ISP (internet service providers) have FUP (fair use policy, limit on amount of data transferred). I need to get a new connection and I would like to measure how much ...
3
votes
4answers
8k views
How to recover data from a bad SD card?
I have a 4GB SD card with some family pictures on it that I need to recover. When I insert the card into my card reader, it shows up as an unknown 32MB device (as /dev/sde) and cannot be mounted. When ...
3
votes
2answers
309 views
How do I time a specific command?
(The linux equivalent of TimeThis.exe)
Something like:
timethis wget foo.com
Receiving foo.com
...
wget foo.com took 3 seconds.
3
votes
3answers
367 views
Why doesn't uname -a return a useful identifier
I typed the command uname -a into my college's server and got this:
2.6.18-274.3.1.el5 #1 SMP Tue Sep 6 20:14:03 EDT 2011 i686 i686 i386 GNU/Linux
Are they trying to hide the version of Linux that ...
3
votes
2answers
94 views
Unatended script execution in ubuntu terminal
I have installed Ubuntu on a VMWare virtual machine.
When I got to installing a VMWare tools, I have stumbled upon a simple question:
If I execute a script (perl script in VMWare tools case), is ...
3
votes
2answers
214 views
Are there any utilities to quickly add, list and remove command aliases?
I'd like to be able to quickly, on-the-fly add (and list/remove) command aliases so that they persist between shell restarts (as if they were added to .bashrc). Are there any ready ...
3
votes
2answers
129 views
Why do I get a 'conformability error' when I attempt to convert water in GNU units?
I've been using the GNU units program and I seem to think that I should be able to convert water between a volume and a weight.
Examples:
You have: 1 gram water
You want: cm^3
conformability error
...
3
votes
2answers
106 views
Peer to peer~ish LAN storage
I have a distributed application that consists in a main CMS server where "human" users can upload videos, pictures (media content, basically) and a bunch of "players" that play those videos or ...
3
votes
2answers
483 views
Fix or alternative for mktemp in OS X
I'm looking at a bash script someone else wrote that uses mktemp:
TEMP=`mktemp --directory`
However, this line does not work on my machine (OS X 10.6).
How would I fix this line so that it is ...
3
votes
1answer
43 views
tac command's option creates strange output [comprehension question]
Say I have this file, containing nothing than
a
b
c
b
a
Using tac --separator=a file in BASH [on a Debian based Linux], I get this:
# empty line
# empty line
b
...
3
votes
1answer
85 views
Understanding the output of the “who -a” command
I ask this question because, while there are many answers on the internet showing that "who -a" is an option, nobody explains how to read the output. If you can provide a link to an online site that ...

