Questions tagged [command-line]

An interface for interacting with a computer using typed commands in a text-oriented environment, as opposed to a graphical user interface (GUI).

Questions that should have this tag

  • Scripting questions
  • BASH or Windows command line commands
  • PowerShell items

Basic Syntax

  • { option1 | option2 } - Choose one or the other
  • [ option ] - Optional
  • COMMAND -The command itself
  • parameter - Parameters that are required to complete the command

Extra Information

  • Commands for questions should have a backtick (`, to the left of the 1 on most keyboards) before and after any commands to help with realizing where the commands are
    • Example: How do I use the DIR command?
  • Whenever possible, because of how extensive and powerful the CLI can be, if there are long commands or scripts, either use the <pre></pre> tag before and after the script, or indent each line with 4 spaces. Example below:
@echo off
echo Hello World!
  • When answering questions, if at all possible, show where other users can replace different variables for their own use
    • Example: Replace the name with the username you are trying to use:
      NET USER JohnSmith
12810 questions
8 answers

How can I display the contents of an environment variable from the command prompt in Windows 7?

In Windows 7, when I start the Command prompt, is there any command to display the contents of an environment variable (such as the JAVA_HOME or PATH variables)? I have tried with echo $PATH, echo PATH and $PATH but none of these work.
  • 26,874
  • 52
  • 105
  • 125
5 answers

How to find a directory on linux?

I have a VPS with Suse Linux 10.3. I've logged in via SSH/putty and am trying to find where my web files are located. Since I'm uploading via FTP in a directory called httpdocs, I assume that this directory exists somewhere. My google searches have…
Edward Tanguay
  • 13,695
  • 37
  • 102
  • 128
9 answers

Using ffmpeg to cut up video

I am using ffmpeg to cut out a section of a large file like this: ffmpeg -i input.wmv -ss 60 -t 60 -acodec copy -vcodec copy output.wmv The -ss part works fine but the -t is ignored. It correctly removes the initial specified seconds specified with…
  • 5,859
  • 3
  • 16
  • 3
4 answers

How to turn off word-wrap in less

Short version: How can I make the less utility in Linux not wrap lines? Long version: Often I need to view huge CSV files using less with hundreds of columns. I frequently only care about the first couple columns. However, word wrap causes one…
  • 9,112
  • 8
  • 35
  • 46
5 answers

How do I run multiple commands on one line in PowerShell?

In a cmd prompt, you can run two commands on one line like so: ipconfig /release & ipconfig /renew When I run this command in PowerShell, I get: Ampersand not allowed. The `&` operator is reserved for future use Does PowerShell have an operator…
  • 9,144
  • 3
  • 24
  • 41
17 answers

Is there any 'sudo' command for Windows?

I always work on a non-administrator account on my Windows computer. Sometimes I need to install programs which requires administrator access. As I mostly use the Windows command prompt, is there a Windows command to escalate privileges, similar to…
  • 10,660
  • 11
  • 43
  • 60
5 answers

How to open files in vertically/horizontal split windows in Vim from the command line

There must be a way, something like this: vim -[option] to open files from command prompt and not from within Vim. split windows vertically or/and horizontally in separate tabs
Andrei Chikatilo
  • 5,069
  • 4
  • 17
  • 14
18 answers

How to clear the contents of a file from the command line?

I have a log file that has a bunch of stuff in it that I don't need anymore. I want to clear the contents. I know how to print the contents to the screen: cat file.log I know how to edit the file, line-by-line: nano file.log But I don't want to…
  • 14,554
  • 30
  • 70
  • 82
20 answers

How to encode base64 via command line?

Is there a terminal command in Mac OS X which will base64 encode a file or stdin?
  • 9,487
  • 11
  • 49
  • 70
4 answers

Go back to previous directory in shell

Is there a way to go back to previous directory we were in using bash,tcsh without using pushd/popd ? I'd like to type something like "back" and got returned to the previous directory I was in. Edit: "cd -" works, but only for current and previous…
Lydon Ch
  • 5,789
  • 8
  • 32
  • 35
8 answers

How to recursively delete directory from command line in windows?

What is the windows equivalent of rm -r [directory-name]?
Eric Wilson
  • 7,868
  • 12
  • 41
  • 50
16 answers

How do you list all processes on the command line in Windows?

Is there a command equivalent to 'ps' on Unix that can list all processes on a Windows machine?
  • 3,874
  • 2
  • 20
  • 11
14 answers

How to get information about an image (picture) from the Linux command-line?

I'm working on a web app and currently migrating some stuff from an old app, but I hate that I have to open an image editor to get some info about images I'm migrating. Things like image dimensions. Is there a command line tool I can use for such…
  • 3,671
  • 2
  • 16
  • 12
9 answers

How to append to a file as sudo?

I want to do: echo "something" >> /etc/config_file But, since only the root user has write permission to this file, I can't do that. But the following also doesn't work. sudo echo "something" >> /etc/config_file Is there a way to append to a file…
  • 7,247
  • 11
  • 38
  • 34
3 answers

Linux unzip command: Option to force overwrite?

I am writing a shell script that unzips a ZIP file into an existing hierarchy of files, potentially overwriting some of the files. The problem is that the unzip command asks for confirmation: replace jsp/extension/add-aspect.jsp? [y]es, [n]o, [A]ll,…
Nicolas Raoul
  • 10,711
  • 18
  • 64
  • 102
2 3
99 100