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).
13,076
questions
798
votes
8
answers
2.6m
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 ...
626
votes
5
answers
1.6m
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 ...
599
votes
9
answers
832k
views
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 ...
572
votes
4
answers
225k
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 ...
560
votes
5
answers
786k
views
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 ...
509
votes
19
answers
876k
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 ...
503
votes
18
answers
742k
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, ...
487
votes
5
answers
496k
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
433
votes
19
answers
699k
views
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?
390
votes
4
answers
680k
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:
...
382
votes
8
answers
901k
views
How to recursively delete directory from command line in windows?
What is the windows equivalent of rm -r [directory-name]?
367
votes
15
answers
1.2m
views
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?
363
votes
14
answers
427k
views
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.
...
338
votes
3
answers
479k
views
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 ...
336
votes
9
answers
116k
views
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" ...
307
votes
5
answers
960k
views
Setting and getting Windows environment variables from the command prompt?
I want to set an environment variable from the command prompt and then be able to access it globally (for instance, I should see it by going to System -> Environment Variables).
When I use the set ...
302
votes
9
answers
1.3m
views
Using cd command in Windows command line, can't navigate to D:\
This may be a silly 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 the ...
294
votes
24
answers
220k
views
Command-line application for converting SVG to PNG on Mac OS X
Are there any command-line programs that can convert an SVG to PNG that run on macOS?
278
votes
8
answers
912k
views
Get Last Modified Date of File in Linux
I'm new to Linux. I'm using the command-line. I'm trying to view the last modified date of a file. How do I do that in Linux from the Command Line?
262
votes
12
answers
824k
views
How can I execute a Windows command line in background?
How can I execute a windows command line in the background, without it interacting with the active user?
259
votes
12
answers
392k
views
How do I start Chrome using a specified "user profile"?
I use the new built-in "Users" feature of Chrome to switch between Home/Work accounts easily. However, Chrome remembers the "last" user profile you had selected when launching new windows. This is a ...
259
votes
4
answers
273k
views
How to list Chocolatey packages already installed and newer version available from the command line
I have the following packages installed with Chocolatey.
choco list
> choco list
Chocolatey v0.9.9.2
adobereader 11.0.10
...
253
votes
8
answers
24k
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.
251
votes
35
answers
296k
views
Is there a way to display a countdown or stopwatch timer in a terminal?
How can I display a real-time countdown timer on the Linux terminal? Is there an existing app or, even better, a one liner to do this?
247
votes
11
answers
205k
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.
246
votes
9
answers
1.0m
views
How can I direct a query to specific DNS server?
I would like to issue a query to a specific DNS server, whose IP address I know. It doesn't really matter if it's on Windows or *nix.
In Windows I can do something like:
C:\Documents and Settings\...
243
votes
4
answers
315k
views
How to add user to a group from Mac OS X command line?
I am 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 version 10.5.8.
The user is 'john', the groups are 'admin' and 'wheel'.
240
votes
5
answers
286k
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, ...
236
votes
10
answers
481k
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 ...
228
votes
8
answers
169k
views
Typing “python” on Windows 10 (version 1903) command prompt opens Microsoft store
This is strange issue I have observed. I installed Active Python 2.7 on Windows 10 (version 1903).
On typing “python” from search, opens the Python 2.7 prompt but when I type from command prompt ...
223
votes
6
answers
345k
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?
...
223
votes
17
answers
183k
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 ...
222
votes
7
answers
470k
views
Browse an UNC path using Windows CMD without mapping it to a network drive
C:\> cd \\somewhere
'\\somewhere'
CMD does not support UNC paths as current directories.
What I usually do to get around this is to map that directory to a network drive and then I could easily ...
218
votes
9
answers
312k
views
How can I find only the executable files under a certain directory in Linux?
How can I find only the executable files under a certain directory in Linux?
216
votes
9
answers
412k
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?
206
votes
11
answers
41k
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 ...
200
votes
13
answers
1.2m
views
How do I edit text files in the Windows command prompt?
On Unix I'd just use vi, but I don't know what the command is on Windows. I am actually trying to edit files over SSH with Windows Server 2008.
198
votes
15
answers
216k
views
Is it possible to `tail -f` the output of `dmesg`?
I want to do something like
dmesg | tail -f
but it doesn't work:
I use Mac OS X v10.6.7 (Snow Leopard). By doing that, tail will exit, instead of monitoring the output.
I wonder if there is a ...
196
votes
10
answers
302k
views
List the current folder folder's sizes with the terminal?
I want a list of the folders from the current directory or one that I specify with their size.
I have tried with du but I only get the size of the directories I specify (du . ./f1), and ls doesn't ...
192
votes
13
answers
725k
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 ...
189
votes
8
answers
394k
views
How to execute a command in screen and detach?
How can I get screen to execute a command and then detach (That is, automatically in a single script without further input beyond initially starting the script)? e.g. I run myscript.sh and it ...
188
votes
20
answers
771k
views
Run a batch file in a completely hidden way
I'm looking for some way to run a batch file (.bat) without anything visible to the user (no window, no taskbar name, .etc..).
I don't want to use some program to do that, I'm looking for something ...
178
votes
3
answers
676k
views
Clear windows command prompt screen using keyboard shortcuts
Is there any way of clearing the command prompt screen in windows using keyboard shortcuts?
177
votes
5
answers
191k
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?
171
votes
9
answers
596k
views
How to run a batch file without launching a "command window"? [duplicate]
On Windows XP, can I run a batch (.bat or .cmd) file, via a shortcut, without a "black window"?
170
votes
10
answers
629k
views
ls-command: how to display the file size in megabytes?
In Unix (Tru64), how do I make the ls command show the file size in megabytes? Currently I am able to show it in bytes using the following:
ls -la
169
votes
3
answers
189k
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 like this:
7z.exe a -t7z archive.7z FolderToArchive\ -mx0
and would like to exclude any \bin\*.* ...
165
votes
3
answers
50k
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 ...
162
votes
6
answers
251k
views
How to retrieve video file information from command line under Linux?
I'd like to see from command line all informations pertaining to a given video file, including length, quality, bitrate, resolution, audio and video formats, number and language of audio streams and ...
160
votes
16
answers
734k
views
How can I find out when Windows was last restarted?
How can I know when my computer running Windows 7 was last restarted?
I prefer a solution that doesn't involve searching the event log, but something like wmic or maybe cmd commands.