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)

62
votes
10answers
34k views

OS X: Base64 encode via command line

Is there a terminal command in Mac OS X which will base64 encode a file or stdin?
32
votes
3answers
46k 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 ...
42
votes
4answers
50k views

What does “2>&1” do in command line?

I know that the > sign is used for output redirection in the command line, but I'm having trouble finding something that explains the use of 2>&1 in the command line. For example: curl ...
87
votes
5answers
154k views

How to recursively delete directory from command line in windows?

Is there a windows equivalent of sudo rm -r [directory-name]?
32
votes
6answers
44k 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?
76
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 ...
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, ...
29
votes
6answers
16k 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 ...
31
votes
8answers
87k 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 ...
24
votes
5answers
37k views

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

What command do I use to find the size of all the files (recursively) in a Linux or Mac OS X directory?
35
votes
6answers
59k 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?
24
votes
1answer
31k 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, ...
19
votes
1answer
8k views

Use terminal scrollbar with tmux

I know how to scroll in tmux using the keyboard, but I noticed that it looks like there's a way to use the terminal scrollbar with GNU Screen. Can this be done with tmux?
12
votes
1answer
6k 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 ...
40
votes
5answers
44k 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 ...
10
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 ...
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 ...
27
votes
4answers
74k 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: ...
27
votes
9answers
33k 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 ...
25
votes
3answers
61k 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
27k 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: ...
35
votes
3answers
16k 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.
32
votes
6answers
31k 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 ...
13
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
5answers
8k views

How do I full-screen my CMD? [duplicate]

I work a LOT in the windows command line. Unlike other windows, it doesn't maximize - it just goes a big as it can depending on the buffer size. Is there any way I can get the CMD to act like the ...
11
votes
2answers
14k 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 ...
13
votes
4answers
50k 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
1answer
74k 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
23k 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
4answers
28k 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 ...
5
votes
2answers
731 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 ...
21
votes
3answers
14k 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. ...
12
votes
8answers
40k 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
29k 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
2answers
10k views

Converting images to video using FFMPEG on Windows

I'm trying to convert a series of JPEG images into a time lapse video. They're in the format IMGP0001.JPG, IMGP0002.JPG, etc. From the looks of things, this should match the pattern IMGP%04.JPG. I've ...
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
20k 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
34k 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 ...
22
votes
6answers
9k views

How to pipe text from command line to the clipboard

I'd like to do something like dir *.* > clipboard ie. get to get the standard output of a command line program copied to the clipboard. Can this be done on a standard XP machine without ...
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?