Questions tagged [command]

One or a set of directives issued in the *nix environment to get information, change the state of something or to execute something. In other words: To gain an objective.

978 questions
740
votes
40 answers

Tracking down where disk space has gone on Linux?

When administering Linux systems I often find myself struggling to track down the culprit after a partition goes full. I normally use du / | sort -nr but on a large filesystem this takes a long time before any results are returned. Also, this is…
Owen Fraser-Green
202
votes
4 answers

What does <<< mean?

What does <<< mean? Here is an example: $ sed 's/a/b/g' <<< "aaa" bbb Is it something general that works with more Linux commands? It looks like it's feeding the sed program with the string aaa, but isn't << or < usually used for that?
Daniel Jonsson
  • 2,165
  • 3
  • 12
  • 9
196
votes
3 answers

ifconfig command not found

I've just installed CentOS7 as a virtual machine on my mac (osx10.9.3 + virtualbox) .Running ifconfig returns command not found. Also running sudo /sbin/ifconfig returns commmand not found. I am root. The output of echo $PATH is as below.…
RobSeg
  • 2,380
  • 2
  • 12
  • 13
159
votes
7 answers

How to move all files and folders via mv command

How can I move all files and folders from one directory to another via mv command?
Luka
  • 1,947
  • 3
  • 9
  • 14
138
votes
7 answers

Why is cd not a program?

I've always wondered why cd isn't a program, but never managed to find the answer. Anyone know why this is the case?
AkshaiShah
  • 3,549
  • 5
  • 17
  • 9
122
votes
3 answers

Why is "echo" so much faster than "touch"?

I'm trying to update the timestamp to the current time on all of the xml files in my directory (recursively). I'm using Mac OSX 10.8.5. On about 300,000 files, the following echo command takes 10 seconds: for file in `find . -name "*.xml"`; do echo…
Casey Patton
117
votes
12 answers

Generate random numbers in specific range

After googling a bit I couldn't find a simple way to use a shell command to generate a random decimal integer number included in a specific range, that is between a minimum and a maximum. I read about /dev/random, /dev/urandom and $RANDOM, but none…
BowPark
  • 4,583
  • 12
  • 40
  • 69
106
votes
3 answers

What's the difference between "realpath" and "readlink -f"

I've read a lot about realpath command and how it has been deprecated with the readlink -f being now recommended. I have also seen in some places that the reason why realpath was introduced was for the lack of such functionality in readlink and that…
Felipe Leão
  • 1,225
  • 2
  • 9
  • 10
84
votes
3 answers

What is the point of the `cd` external command?

As referenced in this fine answer, POSIX systems have an external binary cd in addition to the shell builtin. On OS X 10.8 it's /usr/bin/cd. You can't use it like the builtin cd since it exits immediately after changing its own working directory.…
kojiro
  • 4,426
  • 3
  • 23
  • 31
84
votes
15 answers

What are the legitimate uses of the `touch` command?

What's the point of the touch command? I know I can create empty files with it, but so is also the case with echo -n. Otherwise, why would someone need to change the timestamps of a file? Unless to create the false impression about the age of a…
Quora Feans
  • 3,646
  • 7
  • 28
  • 46
83
votes
4 answers

How to run time on multiple commands AND write the time output to file?

I want to run time command to measure time of several commands. What I want to do is: Use the time command to measure the time it takes to run multiple commands together Write only the time output to a file Write the stderr of all commands I am…
Karel Bílek
  • 1,729
  • 5
  • 17
  • 26
75
votes
4 answers

What is the purpose of -e in sed command?

I can't find any documentation about the sed -e switch, for simple replace, do I need it? e.g. sed 's/foo/bar/' VS sed -e 's/foo/bar/'
Howard
  • 897
  • 2
  • 7
  • 5
71
votes
13 answers

How to randomly sample a subset of a file

Is there any Linux command one can use to sample subset of a file? For instance, a file contains one million lines, and we want to randomly sample only one thousand lines from that file. For random I mean that every line gets the same probability…
clwen
  • 833
  • 1
  • 6
  • 8
69
votes
3 answers

What does "rm is hashed" mean?

I'm going through http://mywiki.wooledge.org/BashGuide/CommandsAndArguments and came across this: $ type rm rm is hashed (/bin/rm) $ type cd cd is a shell builtin Just a little earlier, the guide listed the various types of commands understood by…
user15760
65
votes
4 answers

How to create custom commands in Unix/Linux?

Can anyone guide me to create custom commands in Unix/Linux.
Qadir Hussain
  • 803
  • 1
  • 7
  • 5
1
2 3
65 66