Questions tagged [command-line-interface]

A command-line interface (CLI) is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks.

A command-line interface (CLI) is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks.

1564 questions
41
votes
6 answers

prevent xargs from quitting on error

According to the man page, xargs will quit if one of the execution lines exits with an error of 255: If any invocation of the command exits with a status of 255, xargs will stop immediately without reading any further input. An error message is…
JDS
  • 2,598
  • 4
  • 30
  • 49
41
votes
8 answers

Force local IP traffic to an external interface

I have a machine with several interfaces that I can configure as I want, for instance: eth1: 192.168.1.1 eth2: 192.168.2.2 I would like to forward all the traffic sent to one of these local addresses through the other interface. For instance, all…
calandoa
  • 1,285
  • 2
  • 12
  • 14
40
votes
4 answers

What's a secure alternative to using a MySQL password on the command line?

We have a PHP command-line script to version a database. We run this script whenever a developer has added a new database patch. The script runs the patch with the MySQL command-line: system('mysql --user=xxx --password=xxx < patch.sql'); However,…
BenMorel
  • 4,507
  • 10
  • 57
  • 85
39
votes
52 answers

Favorite Unix command line aliases?

What are your favorite command line aliases (bash/sh/tcsh) aliases? Here are a few of mine. alias lsr='ls -lrt' alias gon='cd $HOME/Notes' alias devdb='mysql -h dev --user=x --password=secret dbname' alias ec='rm *~'; # emacs cleanup alias…
anon
39
votes
3 answers

How to view hidden files using Linux `find` command

On a Linux server, I need to find all files with a certain file extension in the current directory and all sub-directories. Previously, I have always used the following command: find . -type f | grep -i *.php However, it doesn't find hidden files,…
Tom
  • 4,277
  • 11
  • 42
  • 52
38
votes
7 answers

Ssh, run a command on login, and then Stay Logged In?

I tried this with expect, but it didn't work: it closed the connection at the end. Can we run a script via ssh which will log into remote machines, run a command, and not disconnect? So ssh in a machine, cd to such and such a directory, and then run…
jonathan
  • 381
  • 1
  • 3
  • 3
38
votes
4 answers

How to check who is currently logged on to windows workstation from command line?

Environment is in domain, server is Windows Server 2003, workstations have Vista and XP installed. I need the way to check remotely who is currently logged on workstation, preferably from some simple command line and without sysinternals or third…
Andrija
  • 579
  • 2
  • 5
  • 9
38
votes
4 answers

Get directory containing the currently executed batch script

I use %0 in batch file to get the containing directory of the batch file but the result is :- c:\folder1\folder2\batch.bat I want just directory, without batch file name, like this :- c:\folder1\folder2\ How can I do it? Maybe I should filter the…
38
votes
16 answers

How to get own process pid from the command prompt in Windows

I'm trying to find a way to get my own PID from a command prompt (for later use in bat scripts). So far the only useful way I found was to use getpids.exe from here : http://www.scheibli.com/projects/getpids/index.html, but I'm looking for a command…
radai
  • 525
  • 2
  • 5
  • 9
38
votes
10 answers

Testing a website from Linux command line

I am looking for a tool to test a website from a Linux command line. From the output, I need to know the http response (status codes) but also benchmark the time it takes to download the different elements of the site. Thank you in advance.
Embreau
  • 1,287
  • 1
  • 9
  • 10
37
votes
10 answers

How to take ownership of files from the command line?

Every so often I run into a file that I need to take ownership of. I normally use cacls for changing ntfs permissions, but it doesn't seem to do ownership. Under *nix I would run something like chown me:me . Is there a windows equivalent to…
Joe
  • 1,545
  • 1
  • 10
  • 15
35
votes
2 answers

How to disable "WARNING: apt does not have a stable CLI interface..."

I'm trying to write a script which will output the number of upgrade-able packages from apt. However it keeps giving me this warning with it also: # sudo apt update | grep packages | cut -d '.' -f 1 WARNING: apt does not have a stable CLI…
CorruptComputer
  • 453
  • 1
  • 4
  • 5
35
votes
81 answers

Biggest command-line mistake?

What is the most damage (of whatever kind) that you have ever caused with a single mistaken/mistyped/misguided command line? I deleted a production system database by mistake a while back, for example, but I was lucky (i.e. backed-up) and there was…
Peter Hilton
  • 475
  • 1
  • 11
  • 11
35
votes
7 answers

Delete Files Older than (x) Days?

What's a good Windows command line option for deleting all files in a given folder older than (n) days? Also note there may be many thousands of these files, so forfiles with a shell to cmd is not a great idea here.. unless you like spawning…
Jeff Atwood
  • 13,104
  • 20
  • 75
  • 92
35
votes
13 answers

how to generate a random MAC address from the Linux command line

How do I generate a random MAC address from the Linux command line? I search for a solution that only requires standard tools commonly found on the Linux command line. The MAC address will be used for a guest KVM.
Erik Sjölund
  • 2,115
  • 5
  • 22
  • 27