Questions tagged [command-line]

This tag is for questions that are about using the command-line interface (CLI), including the use of standard command-line tools and shell commands. However, for questions that are specific to each shell (like Bash, ZSH etc.), use the tag of that particular shell as well.

What Questions Should Have This Tag?

  • How do I do this via command line?
  • Basic Command Line commands
  • Shell Specific commands (use shell specific tag as well)

Basic Definitions:

Command Line Interface is a way of interacting with the system and software by typing text commands into a terminal (or terminal emulator).


The command-line is also known as

  • Console
  • Terminal
  • Command prompt
  • Shell (however, be aware that applications other than the shell can have their own command line interface)

Brief Introduction to the Subject:

"Under Linux there are GUIs (graphical user interfaces), where you can point and click and drag, and hopefully get work done without first reading lots of documentation. The traditional Unix environment is a CLI (command line interface), where you type commands to tell the computer what to do. That is faster and more powerful, but requires finding out what the commands are."

from man intro(1)

Some users prefer using the command line for some tasks because it saves them time and effort. They also benefit from being able to create scripts to automate common tasks, and they can use the command line to configure their operating system on a very low level to exactly fit their needs.


Important Links for Learning More:

Questions using this tag might be related to Bash - the default command line shell in Ubuntu, Shell-Scripting and Programming.

22527 questions
1392
votes
11 answers

How do I save terminal output to a file?

How do I save the output of a command to a file? Is there a way without using any software? I would like to know how.
led-Zepp
  • 14,195
  • 5
  • 16
  • 12
783
votes
4 answers

How to delete a non-empty directory in Terminal?

How do I delete the following directory? I typed: rmdir lampp This error comes up: rmdir: failed to remove `lampp': Directory not empty Is there a command to delete all the files in the directory and delete the directory folder?
naveen
  • 8,057
  • 4
  • 15
  • 14
647
votes
9 answers

How do I check which shell I am using?

I read that terminal is nothing but shell, and Unix provides different flavors of shells: Bourne shell (sh) C shell (csh) TC shell (tcsh) Korn shell (ksh) Bourne Again shell (bash) Questions: When I open a terminal window, which shell is opened…
GMudide
  • 6,645
  • 3
  • 14
  • 7
460
votes
12 answers

How do I move all files from one folder to another using the command line?

I would like to know how could I move all files from a folder to another folder with a command line. Let's say I'm in my Downloads folder and there are a 100 files that I would like to move to my Videos folder, without having to write all the files…
Michael
  • 4,601
400
votes
11 answers

How can I view the contents of tar.gz file without extracting from the command-line?

I want to see the contents (list of files and folders) of an archive, for example a tar.gz file without extracting it. Are there any methods for doing that?
Avinash Raj
  • 78,556
394
votes
10 answers

How to check if a command succeeded?

Is there any way to check if there is an error in executing a command? Example : test1=`sed -i "/:@/c connection.url=jdbc:oracle:thin:@$ip:1521:$dataBase" $search` valid $test1 function valid () { if $test -eq 1; then echo "OK" else echo…
moata_u
  • 5,413
317
votes
5 answers

Why did the command ":(){ :|: & };:" make my system lag so badly I had to reboot?

DANGER! Do not run this command to 'test' it unless you are prepared for a crash and/or force-rebooting your system. I was in my Virtualbox running 12.04 trying to compile an app, and while waiting I happened to chance upon a forum where a comment…
blade19899
  • 26,704
304
votes
11 answers

How do I search my command-line history for commands I used before?

Other than viewing the history, is there a way to filter my history? Say I want to search for a command that started with "ssh"?
Blankman
  • 8,275
296
votes
7 answers

How do I find the kernel version, Ubuntu release and disk partition information from the terminal?

Which commands will give me information about following using Terminal? Kernel Version Distribution version no. All partition size of the HDD
KK Patel
  • 19,083
252
votes
5 answers

How to create a permanent "alias"?

If you create an alias for example: alias cls="clear" It exists untill you kill terminall session. When you start a new terminal window the alias doesn't exist any more. How to create "permanent" alias, one that exists in every terminal session?
Zango
  • 5,011
247
votes
3 answers

How to open file with default application from command line?

In Nautilus, when you double click a file, it will open it with the default application associated with the file's extension. For instance, .html files will open in a web browser and .pdf will be opened with Document Viewer. Is there a way to…
242
votes
9 answers

What is the command to run System Settings from a terminal?

System Settings can be run from the launcher (pinned by default), the Dash, or the power cog. But what command would I enter in a terminal window if I want to run it from there?
241
votes
6 answers

How to create an empty file from command line

How can I create an empty file from the command line?
NES
  • 33,195
236
votes
20 answers

Comparing the contents of two directories

I have two directories that should contain the same files and have the same directory structure. I think that something is missing in one of these directories. Using the bash shell, is there a way to compare my directories and see if one of them is…
AndreaNobili
  • 4,539
  • 10
  • 26
  • 36
228
votes
6 answers

How to find all files with the same extension within a directory

I want to search for all .conf files in /etc/. I tried grep -r *.conf /etc, but the result isn't right. What am I doing wrong?
Adrian George
  • 3,531
  • 7
  • 23
  • 30
1
2 3
99 100