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
13258 questions
827
votes
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.
Jonas
  • 28,660
656
votes
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…
620
votes
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…
Neil
  • 6,329
  • 3
  • 18
  • 3
593
votes
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…
David
  • 9,854
588
votes
5 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…
User1
  • 9,701
530
votes
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…
Andrew
  • 15,494
516
votes
19 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…
ukanth
  • 10,800
498
votes
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
493
votes
14 answers

Mac OS X equivalent of the Ubuntu "tree" command

Is there an equivalent to the Ubuntu tree command for Mac OS X?
444
votes
19 answers

How to encode base64 via command line in macOS/OS X?

Is there a terminal command in macOS/OS X which will base64 encode a file or stdin?
Josh
  • 9,947
426
votes
4 answers

What is the Windows equivalent of the Unix command cat?

I want to do exactly what unix "cat" does, but on my PC. Is there a simple equivalent command for the Windows command line? Specifically I want to create a file from all the files of a given type in a folder In Unix: cat *fna…
Kirt
  • 7,561
409
votes
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
  • 6,289
385
votes
8 answers

How to recursively delete directory from command line in windows?

What is the windows equivalent of rm -r [directory-name]?
Eric Wilson
  • 8,068
379
votes
15 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?
readonly
  • 4,064
369
votes
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…
JWL
  • 3,891
1
2 3
99 100