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.
Questions tagged [command]
1068 questions
839
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
235
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,525
201
votes
4 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,480
182
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
- 2,177
146
votes
14 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…
BowPark
- 5,285
144
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,679
132
votes
3 answers
What's the difference between "realpath" and "readlink -f"
I've read a lot about the realpath command and how it has been deprecated with 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,495
- 2
- 11
- 10
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
99
votes
5 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
- 2,111
96
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
- 1,107
89
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,774
85
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 to…
clwen
- 993
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,927
83
votes
8 answers
Compute bcrypt hash from command line
I would like to compute the bcrypt hash of my password. Is there an open source command line tool that would do that ? I would use this hash in the Syncthing configuration file (even if I know from here that I can reset the password by editing the…
Gabriel Devillers
- 1,468
75
votes
7 answers
List all commands that a shell knows
What can I type at my shell (which happens to be bash ) that will list all the commands that are recognized? Also, does this differ by shell? Or do all shells just have a "directory" of commands they recognize? Secondly, different question, but how…
themirror
- 7,298
- 11
- 35
- 38