A command-line interface (or CLI) is a method of interacting with your OS or software by typing commands on your keyboard.

learn more… | top users | synonyms (3)

32
votes
3answers
45k views

Save a single web page (with background images) with Wget

I want to use Wget to save single web pages (not recursively, not whole sites) for reference. Much like Firefox's "Web Page, complete". My first problem is: I can't get Wget to save background images ...
32
votes
6answers
43k views

How do I use 7-zip to backup files, but exclude some directories

I would like to use 7-zip to backup a directory, but I would like it to exclude all directories named ".svn" (anywhere in the source tree). Does anybody know if this is possible and in that case how?
84
votes
5answers
148k views

How to recursively delete directory from command line in windows?

Is there a windows equivalent of sudo rm -r [directory-name]?
74
votes
2answers
16k views

How to append to a file as sudo? [duplicate]

Possible Duplicate: sudo unable to write to /etc/profile I want to do: echo "something" >> /etc/config_file But, since only the root user has write permission to this file, I can't ...
52
votes
9answers
125k views

How to run a batch file without launching a “command window”?

On Windows XP, can I run a batch (.bat or .cmd) file, via a shortcut, without a "black window"?
17
votes
5answers
3k views

Good PowerShell guide, getting started through more advanced usage

Does anyone have a really good tutorial or getting started guide for Microsoft's PowerShell? I'm a long time Linux/Unix user, and very familiar with scripting languages, command-line usage with bash, ...
31
votes
8answers
84k views

Hibernate computer from command line on Windows 7

I am trying to hibernate my computer from the command. I was using shutdown /s /t 20 to shutdown the the computer. I change /s to /h to hibernate and now it just returns the usage text as if it ...
28
votes
6answers
15k views

How can I trigger a notification when a job/process ends?

The place I work at has commands that take a long time to execute. Is there a command/utility that I can use to notify me when the command execution is over? It could be a popup window or maybe a ...
23
votes
4answers
35k views

How do I get the size of a Linux or Mac OS X directory from the command-line?

What command do I use to find the size of all the files (recursively) in a Linux or Mac OS X directory?
34
votes
6answers
58k views

Recursively delete empty directories in Windows

I have a directory on my Windows 7 machine that has hundreds if not thousands of sub-directories. Some of them have files, some do not. I want to delete all the empty directories. Looking at the ...
14
votes
4answers
3k views

A command before every bash command

Does anyone know a mean of putting a 'time' command before every command in a bash session?
23
votes
1answer
30k views

Show only current directory name (not full path) on bash prompt

The way my bash prompt is currently configured, it shows the whole path to the current directory. This is annoying when I'm deep inside a directory tree, as the prompt becomes so long that every ...
10
votes
3answers
21k views

Recursively rename files (change extension) in Linux

How do I rename all files in a directory, recursively, changing one file extension to another, for thousands of files in thousands of subfolders? I see a lot of commands that do almost what I want, ...
10
votes
1answer
5k views

pfctl port forwarding in Mac osx?

-A PREROUTING -s 10.0.10.0/24 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080 -A PREROUTING -s 10.0.10.0/24 -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8080 -A POSTROUTING -s 10.0.10.0/24 -o ...
10
votes
3answers
12k views

Simple built-in way to encrypt and decrypt a file on a Mac via command-line?

Are there any built in command-line tools that I can encrypt and decrypt a text file (and provide it some sort of password).
20
votes
3answers
6k views

Best practice for Windows PATH/environment variables managing?

Right now, it's such a mess. Every time I install a new program that does something trivial in the command line, I have to add it to the path. In fact, I'm developing on Ruby and even gems ...
39
votes
5answers
43k views

Execute multiple commands with 1 line in Windows commandline?

How can I execute multiple commands in the Windows commandline with just a single line? So for example say I want to perform an SVN update and then copy all of the files to another location... svn ...
9
votes
6answers
15k views

Converting a PDF to black & white with ghostscript

Similarly to this question: Convert a PDF to greyscale on the command line in FLOSS? I have a PDF-document and want to convert it to pure black and white. So I want to discard halftones. To ...
26
votes
4answers
71k views

How do I escape spaces in command line in Windows without using quotation marks?

For example what is the alternative to this command without quotation marks: CD "c:\Documents and Settings" The full reason I don't want to use quotation marks is that this command DOES work: ...
25
votes
9answers
32k views

Is there a shortcut command in Windows command prompt to get to the current users home directory like there is in Linux?

I am used to using cd ~ to get right into my home directory. In windows command prompt I have to do cd Users\username to get there. Is there a shortcut like the Linux one? It would be nice if I ...
24
votes
3answers
58k views

How do I log out of `sudo su`?

I'm using sudo su to start mysql and do some homework with it. When I finish with mysql (or any other command), then I'm still in sudo. How do I "log out", so my prompt changes back from # to $?
14
votes
1answer
25k views

How to detect the speed (fast or gigabit ethernet) of a network connection over Windows command line

To troubleshoot a network problem I would like to inquire the real network "speed" for a given network adapter, which can be seen when opening the "status" of a network connection under Windows: ...
8
votes
2answers
41k views

Windows 7: how can I add an IP range in the “route” command?

I'm using two network connections, and I tried using the "route" command so that when I access a specific internal IP on my LAN, it would use connection 1, anything else would go normally through ...
35
votes
3answers
15k views

How do I execute multiple commands when using find?

I'm trying to run multiple commands on things I have found, how can I achieve this? find . -exec cmd1; cmd2 does not seem to work; it instead runs cmd2 after cmd1 has been executed on every file.
31
votes
6answers
30k views

scp to remote server with sudo

I have a file on server A (which is behind a NAT so not directly addressable). The file needs to be copied to server B in a directory restricted to root. I have an account on server B with sudo ...
11
votes
2answers
13k views

Is there a way to get file metadata from the command line?

Is there a way to get a file's metadata from the command line in Windows XP and above? Particularly, I'm interested in getting the information one might normally see on the "Details" tab of a file's ...
9
votes
5answers
12k views

How to set Title of CMD to current working Directory in Windows XP

How does one set the title of the of the Command Prompt (CMD) in Windows XP to the current working directory dynamically ? I can use title %CD% however, this is a temporary fix and the title ...
12
votes
1answer
2k views

Why do we have login, non-login, interactive, and non-interactive bash shells?

So the bash man pages explain what login and interactive shells are: A login shell is one whose first character of argument zero is a -, or one started with the --login option. An ...
12
votes
1answer
71k views

Batch file that runs cmd.exe, a command, and then stays open at prompt

I would like to make a batch file that: Opens cmd.exe Within that Command Prompt runs net use to display mapped share paths Leaves the window open so that I can run additional commands if I wish to ...
11
votes
7answers
5k views

Good Alternative to Cygwin with Copy/Paste?

I am annoyed that I can't copy and paste into Cygwin... is there a good alternative to Cygwin that will let me do this?
11
votes
5answers
22k views

How can I count the number of folders in a drive using Linux?

I need to organise an external HDD such that there is no more than 500 folders on it. Ubuntu's "Properties" pane shows only the file count, not the folder count. Is there a simple command line that ...
5
votes
1answer
12k views

How to cut at exact frames using ffmpeg?

I'm trying to use ffmpeg to cut video files at precise times. The ffmpeg help shows an option -timecode_frame_start to specify the starting frame but I am unable to get this command to work. The ...
5
votes
2answers
717 views

Access Finder's “Open With” menu from the commandline (for tab completion)

On Mac OS X, I know one can open a file from the commandline with its default application with open, and with other applications with open -a <application name>. Thus, open movie.avi open -a ...
4
votes
4answers
26k views

How do I recursively list filenames (only) in DOS/Windows? [duplicate]

Possible Duplicate: Get bare file names recursively in command prompt I would like to recursively list all files in a directory, showing filenames only (without extensions and without the ...
20
votes
3answers
13k views

Elevated command line prompt can't access shared drives in Windows 7

I map a share from another machine using my user account. I launch an elevated command prompt (cmd.exe, right click, Run as administrator). Navigating to shared drive (Z:) results in: The system ...
18
votes
5answers
9k views

Is there a Keyboard shortcut to close a Command Prompt window?

Is there any keyboard shortcut to close the Command Prompt window in Windows 7? Alt+F4 does not seem to work on a Command Prompt window. I close it right now by typing exit and Enter at the prompt. ...
13
votes
4answers
48k views

change directory command doesn't work in windows command prompt [duplicate]

Possible Duplicate: Using cd Command in Windows Command Line, Can’t Navigate to D:\ Somehow cd command is not working in windows command prompt when I want to change the drive. For ...
12
votes
8answers
39k views

bash: how to pass command line arguments containing special characters

I've written myself a linux program program that needs a regular expression as input. I want to call the program in the bash shell and pass that regular expression as a command line argument to the ...
9
votes
2answers
2k views

How to open a PowerShell in the current folder?

This keyboard shortcut Shift + Menu, W, Enter opens the command prompt. Scott Hanselman points to an app that does the same for PowerShell and says it's builtin in Windows 7. The tool doesn't seem to ...
7
votes
3answers
28k views

How do I change automatic logon via Script or Command Line?

After deploying a Windows 7 image to Stand alone machines we run into the following problem. If we set autologon to off then we have to log in manually and activate Windows and Office - the Keys ...
5
votes
5answers
5k views

What is the best way to hide a command prompt window

I'm running the headless interface of VirtualBox (VBoxHeadless.exe) with Ubuntu Server running on it. Every time I run VBoxHeadless, it starts a command prompt window which just sits on the taskbar ...
3
votes
2answers
18k views

How do I recover from “repair pending” error in SFC?

I am trying to fix an issue with Windows registry and services. I tried running sfc command but this is the error message I get? C:\Windows>sfc /scannow Beginning system scan. This process will ...
3
votes
4answers
33k views

Remove a user's password using “net” command'

is it possible to remove a user's password using the net command? I tried "net user <name> *" and just hitting return twice, but this does not work as expected. Is there any other way to do ...
1
vote
8answers
9k views

How do I rename a bunch of files in the Command Prompt?

I have a problem with filenames. The stupid camera I am using resets the autonumber sequence every so often, and therefore I am getting tons of conflicts if I try and put lots of photos in a single ...
11
votes
2answers
9k views

Possible values of %PROCESSOR_ARCHITECTURE%

I'm writing a batch script for windows 7 and want to handle both 64 bit and and x86 processors. What are the possible values of the Windows %PROCESSOR_ARCHITECTURE% environment variable?
10
votes
8answers
38k views

How to get my external IP address (over NAT) from the Windows command-line?

The Windows "ipconfig" command can only show me the parameters from the Ethernet interfaces from my machine (even with the ipconfig /all argument). It can show detailed information about the ...
8
votes
3answers
14k views

Windows 7 equivalent for ntrights.exe

What is an equivalent for ntrights.exe on Windows 7? I need it to be able to be run from the command line.
8
votes
3answers
8k views

adding PATH with SETX or PATHMAN or something else?

I am trying to add a PATH from command line, as with SETX %PATH%... it always expands the PATH, which I don't want. PATHMAN is exactly for this purpose, but it doesn't work for me on Windows 7. It ...
8
votes
1answer
806 views

How to customise ALL console windows

Every time I start using a new conmsole application, I have to set my font to Consolas (FTW!), colours, console and window size for that application (Save settings for all windows with this title, or ...
6
votes
1answer
5k views

Rename multiple files as “Modified Date/Time” using cmd or Powershell

I have hundreds of JPG files in a folder. I want to rename each file so that the file name is replaced with "Modified Date/Time" of that file, namely DD.MM.RRRR.HH.MM.jpg. For example, Before ...