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)

203
votes
9answers
147k views

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 ...
154
votes
6answers
101k views

How to chmod 755 all directories but no file (recursively)?

How to chmod 755 all directories but no file (recursively) ? Inversely, how to chmod only files (recursively) but no directory ?
148
votes
4answers
324k views

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 ...
145
votes
8answers
8k views

What do the parentheses and number after a Unix command or C function mean?

I keep seeing parentheses and a number after a command in Unix or Linux or C function. For example: man(8), ftok(2), mount(8), etc. What do these mean? I see them in man too.
134
votes
5answers
69k views

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] <file-list> to open files from command prompt and not from within Vim. split windows vertically or/and horizontally in separate tabs ...
129
votes
9answers
13k views

I accidentally typed password into bash command line

I accidentally typed my password into bash command line, mistaking the Last login: ... line for Wrong password (I was in a hurry). What do I do to cover my trace? What I did was editing .bash_history ...
108
votes
3answers
25k views

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 ...
104
votes
9answers
114k views

Where does $PATH get set in OS X 10.6 Snow Leopard?

I type echo $PATH on the command line and get ...
102
votes
18answers
7k views

What's the quickest way to count the number of each character in a file?

I want to count the A's T's C's G's N's and "-" characters in a file, or every letter if needed, is there a quick Unix command to do this?
86
votes
2answers
73k views

How to add user to a group from Mac OS X command line?

trying to add a user to a group from the command line but can't figure out how? Specifically this is on Mac OS X Server 10.5.8 like to add user to 'admin' and 'wheel' groups
86
votes
2answers
63k views

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: ...
83
votes
7answers
8k views

How can I create a file with a specific size from a command line?

How can I create a file (e.g. using the touch command or another similar way), but with a specific size (e.g. 14 MB)? The use case is to test FTP with various file sizes. If we can create a file with ...
82
votes
6answers
55k views

What's different between Ctrl+Z and Ctrl+C in Unix command line?

I'm using Mac OS X Terminal. And I use Ctrl+Z or Ctrl+C to stop some programs. But I realized that I don't know what they're exactly doing. What are they and what's the difference between them? ...
76
votes
6answers
98k views

How do I find out what version of Linux I'm running?

Is there a way to determine what version (distribution & kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system?
76
votes
4answers
169k views

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 ...
71
votes
5answers
115k views

How to recursively delete directory from command line in windows?

Is there a windows equivalent of sudo rm -r [directory-name]?
68
votes
5answers
950k views

How do I locate the MAC address of my computer?

I am unable to locate the MAC address in a new computer with Windows 7. I've tried ipconfig /all in the console to which I got no items match your search. I also tried getmac. A screen flashed very ...
65
votes
6answers
4k views

How do I perform commands in another folder, without repeating the folder path?

Is there a clever way to do copy and move operations or a command to duplicate a file, without having to do a cd, then mv after, at the same folder? For example, I have to run the following: mv ...
64
votes
12answers
37k views

How to get information about an image(picture) from linux commandline?

Am working on a web-app, and currently am migrating some stuff from an old app, but I hate that I have to open an image editor to get some info about images am migrating. Things like image dimensions. ...
64
votes
5answers
6k views

How can I permanently customize the Command Prompt in Windows 7?

I would like to change the prompt to $p$g$_$f permanently, but it resets itself every time I reopen the command window. How can I get it to stay the same forever for eternity?
62
votes
7answers
19k views

Windows equivalent of whereis?

Is there an equivalent of the Unix whereis command in Windows? So that I could figure out where commands I can run actually is.
61
votes
8answers
155k views

Can you zip a file from the command prompt using ONLY Windows' built-in capability to zip files?

I have a batch file that outputs a text file. I thought it would be nice if I could zip it up too. This will be used in an uncontrolled environment, so I can't make assumptions about the presence of ...
58
votes
2answers
12k 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 ...
57
votes
4answers
15k views

Forward SSH traffic through a middle machine

SSH tunneling is very confusing to me. I am wondering if I can do this in Linux. I have 3 machines.. A. My local machine at home. B. Machine at work that I can SSH into (middle man). C. My desktop ...
57
votes
10answers
33k views

Is it possible to `tail -f` the output of `dmesg`?

Want to do something like dmesg | tail -f but it doesn't work: I use Mac OSX 10.6.7, by doing that the tail will exit, instead of monitoring the output. I wonder if there is any way to do it, or ...
55
votes
12answers
113k views

Is it possible to download using the Windows command line?

Without using any non-standard (Windows included) utilities, is it possible to download using the Windows command line? The preferred version is Windows XP, but it's also interesting to know for ...
52
votes
1answer
1k views

How is a program that's not in my path being run? [duplicate]

Possible Duplicate: Why am I able to execute a program that is not in my PATH environment variable? I was teaching a coworker about %PATH% and found that if I run "Firefox", it works, but ...
52
votes
12answers
26k views

How to supress “Terminate batch job (Y/N)” confirmation?

In cmd, when we press Ctrl+C we get the target application terminated but if the target application is called from a batch file, we get this "Terminate batch job (Y/N)" confirmation. I can never ...
52
votes
9answers
26k 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?
51
votes
6answers
78k views

How to copy symbolic links?

I have directory that contains some symbolic links: user@host:include$ find .. -type l -ls 4737414 0 lrwxrwxrwx 1 user group 13 Dec 9 13:47 ../k0607-lsi6/camac -> ../../include 4737415 ...
49
votes
8answers
102k 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"?
49
votes
4answers
13k views

Does bash have a hook that is run before executing a command?

In bash, can I arrange for a function to be executed just before running a command? There is $PROMPT_COMMAND, which is executed before showing a prompt, i.e., just after running a command. Bash's ...
48
votes
5answers
37k views

Recursively count all the files in a directory [duplicate]

Possible Duplicate: How can I count the number of folders in a drive using Linux? I have a really deep directory tree on my Linux box. I would like to count all of the files in that path, ...
48
votes
6answers
77k views

How to open command Prompt in current folder by keyboard shortcut?

How to open command Prompt in current folder by keyboard shortcut in Windows 7? Is there any way to implement this. I think Autohotkey could do this, but don't know how
48
votes
9answers
128k views

How can I put the computer to sleep from Command Prompt/Run menu?

I know that almost everything on Windows, like opening any sort of application, can be done from the command prompt or from the Run menu. How can I put my computer to sleep or shut it down? What is ...
47
votes
7answers
93k views

Command prompt (Windows 7) grep equivalent?

Is there a command prompt (Windows 7) grep equivalent? That is, I want to filter out the results of a command: Bash use: ls | grep root What would it be from a Windows command prompt?
46
votes
9answers
112k views

What is the command to use to put your computer to sleep (not hibernate)?

I want to put my Windows PC (Windows 7) into a sleep state via command line (so I can bind to macro button on keyboard). The power button on the PC is setup to but the computer to sleep (but it's ...
45
votes
7answers
14k views

Is it possible to run Windows without GUI?

I'm just wondering if it is possible to run Windows without its GUI like Linux—with just the virtual terminal (tty) The reason behind this is that my Windows 7 box often freezes whenever some ...
45
votes
2answers
39k views

7Zip - Command Line : Exclude folder(s) by wildcard pattern?

Any idea how to exclude a wild-carded path(s) from a command-line 7zip command? I'm doing something this: 7z.exe a -t7z archive.7z FolderToArchive\ -mx0 and would like to exclude any \bin\*.* or ...
44
votes
7answers
83k views

Using cd Command in Windows Command Line, Can't Navigate to D:\

This may be a stupid question, and I think I have looked elsewhere to find the answer... Might be a path issue, but when I open the command line and type from the C:\>: cd D:\ I cannot get to ...
43
votes
6answers
39k views

Create an alias in Windows XP

Back in school, I used to have a .login file along the lines of alias ll = ls -l alias dir = ls -Fhl alias web = cd ~/public/public_www/development I'd like to do that sort of thing with my ...
42
votes
20answers
81k views

How can I mass rename files from the command line or using a 3rd party tool?

I've got a bunch of files named with a the pattern 99 - DescriptiveName.txt and I'd like to remove the number from the front so I just have DescriptiveName.txt. How can I do this? Can I do it from ...
42
votes
12answers
48k views

How to start GUI linux programs from the command line, but separate from the command line?

I've searched for this before, but have never been able to find an answer. In Windows, if I have a console window open, type winmine, and press enter, Minesweeper will appear, completely separate ...
41
votes
9answers
45k views

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, ...
41
votes
5answers
91k views

Run cURL commands from Windows console

Is there a way to install cURL in windows in order to run cURL commands from the command prompt?
41
votes
13answers
56k views

How can I always run the command prompt as administrator?

As a developer, I often have the need to open a command prompt for various purposes. For example, I use iisreset to restart my local web server. I typically open the command window in one of two ...
40
votes
6answers
118k views

ls-command: how to print file size in megabytes?

On Unix (Tru64), how to show file size in megabytes? This procudes sizes in bytes ls -la
40
votes
6answers
45k views

How to list folders using bash commands?

Is there any way to list just the folders in a directory using bash commands? ( as the ls command lists all the files and folders )
39
votes
2answers
6k views

Case insensitive tab completion in Bash

Is there any way to make Bash tab complete case insensitively? $ bash --version GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0) Copyright (C) 2007 Free Software Foundation, Inc. I am ...
39
votes
2answers
41k views

How to find out Mac OS X version from Terminal?

I know how to find Mac OS X version from GUI: Apple Menu (top left) > About This Mac Is there a Terminal command that will tell me Mac OS X version?