Questions tagged [command-line]

The command-line is the interactive interface to your shell.

A command line is a user interface for interacting with software via text commands. They are most often seen as an alternative to the more popular graphical user interfaces (GUI). Because of this, some people use the acronym CLI — command line interface — particularly when drawing parallels and distinctions with GUIs.

Although command line interfaces are found in all kinds of software, the term when used without explicit context usually refers to an operating system's command shell. (e.g. Bourne shell on Unix, cmd.exe on Windows, etc.) This is the sense meant when this tag is used on this website.

Further reading

6194 questions
350
votes
21 answers

How can I get a count of files in a directory using the command line?

I have a directory with a large number of files. I don't see a ls switch to provide the count. Is there some command line magic to get a count of files?
Blake
  • 3,687
144
votes
8 answers

Is there a tool to get the lines in one file that are not in another?

Is there any tool that can get lines which file A contains, but file B doesn't? I could make a little simple script with, e.g, perl, but if something like that already exists, I'll save my time from now on.
daisy
  • 54,555
97
votes
8 answers

How can I get a formatted date for a UNIX timestamp from the command line

I have a UNIX timestamp and I'd like to get a formatted date (like the output of date) corresponding to that timestamp. My attempts so far: $ date +%s 1282367908 $ date -d 1282367908 date: invalid date `1282367908' $ date -d +1282367908 date:…
Umang
  • 1,171
93
votes
5 answers

How can I make a program executable from everywhere

What should I do if I want to be able to run a given program regardless of my current directory? Should I create a symbolic link to the program in the /bin folder?
aneuryzm
  • 1,925
86
votes
8 answers

count lines in a file

I'm sure there are many ways to do this: how can I count the number of lines in a text file? $ file.txt 1020 lines
72
votes
9 answers

Do we have an undo in Linux?

I renamed a few files in one batch script. Is there a way to undo the changes without having to rename them back? Does Linux provide some native way of undoing?
Lazer
  • 35,307
56
votes
3 answers

Why is `--human-readable` needed and not default?

Several command line tools use the -h or --human-readable option to print file size in a human readable format (i.e., 36G vs 37550836). Why is this option needed and not the default? Aren't these tools mainly for output to humans?
DQdlM
  • 1,543
38
votes
6 answers

How to send output from one terminal to another without making any new pipe or file

I am just fooling around on my terminal (Gnome terminal). I was wondering is there a way to send output of one terminal to another without having to make a new file or pipe. for example: on first terminal I run ls and want its output to be displayed…
Alex Jones
  • 6,353
37
votes
4 answers

How to transform a text file into a picture

If I have a plain text file, how can I convert it to an image file through the command line? (and preserve the layout of the ASCII art in it)
Quora Feans
  • 3,866
35
votes
1 answer

Should the usage message go to stderr or stdout?

Should the usage message which is printed with e.g. command -? of a Unix command go to stderr or stdout, and why? Should it go to the same place if the user makes a mistake with an option?
delete
32
votes
1 answer

Why the "v" in mkfs.vfat?

I read in an Internet article to format a partition to FAT32 with the following command: sudo mkfs.vfat -F 32 /dev/sdXn Now I read the man page for mkfs.vfat and it shows mkfs.fat as the name of the command without the v. After that I tried…
mkdrive2
  • 662
29
votes
10 answers

Run two commands on one argument (without scripting)

How can I perform two commands on one input, without typing that input twice? For example, the stat command tells a lot about a file, but doesn't indicate its file type: stat fileName The file command, tells what type a file is: file fileName You…
Lonnie Best
  • 5,123
26
votes
2 answers

Difference between ifconfig and ipconfig?

What is the difference between ifconfig and ipconfig? What do dhcpcd and ifconfig actually do?
Sharath
  • 393
22
votes
6 answers

Is there a Linux command that does nothing, but never exits?

I'm looking for a Linux command that does literally nothing, doesn't output anything, but stays alive until ^C. while true; do; done is not a good solution, because it is CPU intensive.
srigi
  • 323
19
votes
2 answers

Is there a standard Unix command to check English verb conjugation?

Having recently come across wordlist and wordnet, two great discoveries on their own, I'm now looking for a similar tool, if simpler, that will take the bare infinitive of a verb and return the simple past and past participle. Example: $ verbteacher…
sadpluto
  • 293
1
2 3
13 14