Questions tagged [utilities]

small programs used on the command line to do a specific job

Unix shells are primarily glue programs designed to invoke and manage other programs. Many common tasks are performed by small external programs, often called utilities. In unix terminology, utilities include both shell built-ins and external commands.

Utilities with their own tags

  • Text processing, when sed doesn't cut it.
  • Change directory. Related utilities are pushd, pop and dirs to manage a directory stack.
  • Copy files.
  • Print the current (or another) date and time.
  • Process binary data.
  • Look for files in a directory tree.
  • Search a pattern in a file.
  • List the files in a directory.
  • Rename or move files.
  • Remove (delete) files.
  • Simple text processing, mainly regexp replacement.

Utility references

Further reading

317 questions
788
votes
5 answers

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 -- in there?
dogbane
  • 29,087
  • 16
  • 80
  • 60
461
votes
5 answers

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 programs?
lakshmen
  • 6,071
  • 5
  • 17
  • 9
431
votes
18 answers

How can I use sed to replace a multi-line string?

I've noticed that, if I add \n to a pattern for substituting 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 do not/not a test\nBe/' alpha.txt $ diff…
Belmin Fernandez
  • 9,347
  • 15
  • 46
  • 50
192
votes
3 answers

How to list disks, partitions and filesystems in Linux?

In Windows, if you type LIST DISK using DiskPart in a command prompt it lists all physical storage devices, plus their size, format, etc. What is the equivalent of this in Linux?
Mia
  • 1,931
  • 2
  • 11
  • 4
165
votes
20 answers

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 own bash/awk script, but I am looking for a…
Peter.O
  • 32,426
  • 28
  • 115
  • 163
151
votes
6 answers

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 example mean STDOUT? Conversely, how can I make - mean a…
Tim
  • 98,580
  • 191
  • 570
  • 977
124
votes
11 answers

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 I have directories.
prosseek
  • 8,418
  • 16
  • 47
  • 43
96
votes
3 answers

What is the point of the `yes` command?

This question concerns the yes command found in UNIX and Linux machines: Basically, what is the point (if any) and history of this tool? Are there practical applications for it? Can an example be shown where it is useful in a script or chained (via…
Jaryd Malbin
  • 1,031
  • 1
  • 7
  • 7
94
votes
13 answers

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?
nilton
  • 1,043
  • 1
  • 8
  • 5
93
votes
5 answers

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 cross-un*x-like-platform compatible? EDIT: An…
soundly_typed
  • 1,033
  • 1
  • 7
  • 6
92
votes
4 answers

Why use install rather than cp and mkdir?

I've seen in many places used install -d to create directories and install -c to copy a file. Why not use mkdir and cp? Is there an advantage in using install?
Neaţu Ovidiu Gabriel
  • 1,049
  • 1
  • 7
  • 7
89
votes
4 answers

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 them? .. or are they just simply 'built in'; like…
Peter.O
  • 32,426
  • 28
  • 115
  • 163
77
votes
4 answers

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 files in Jedit, it warns me of invalid UTF-8 encoding... The HTML meta tag states "charset=ISO-8859-1". Jedit allows a List of fallback encodings and…
Peter.O
  • 32,426
  • 28
  • 115
  • 163
76
votes
7 answers

How to trick a command into thinking its output is going to a terminal

Given a command that changes its behaviour when its output is going to a terminal (e.g. produce coloured output), how can that output be redirected in a pipeline while preserving the changed behaviour? There must be a utility for that, which I am…
Amir
  • 1,531
  • 1
  • 14
  • 18
62
votes
5 answers

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 that UNIX & Linux sys admins had done on their own…
Mark Tomlin
  • 735
  • 1
  • 6
  • 7
1
2 3
21 22