Top "Command-line" questions

A command line is a string given to a command interpreter that tells it actions to take, such as running programs or copying files.

How do I import an SQL file using the command line in MySQL?

I have a .sql file with an export from phpMyAdmin. I want to import it into a different server using …

mysql sql command-line import
How do I copy a folder from remote to local using scp?

How do I copy a folder from remote to local host using scp? I use ssh to log in my …

shell command-line copy scp
How do I shutdown, restart, or log off Windows via a bat file?

I've been using Remote Desktop Connection to get into a workstation. But in this environment, I cannot use the power …

windows batch-file command-line restart shutdown
How do I set a variable to the output of a command in Bash?

I have a pretty simple script that is something like the following: #!/bin/bash VAR1="$1" MOREF='sudo run command against $…

bash shell command-line
Adding a directory to the PATH environment variable in Windows

I am trying to add C:\xampp\php to my system PATH environment variable in Windows. I have already added …

windows command-line path environment-variables
How do I parse command line arguments in Bash?

Say, I have a script that gets called with this line: ./myscript -vfd ./foo/bar/someFile -o /fizz/someOtherFile or …

bash command-line scripting arguments getopts
How to count lines in a document?

I have lines like these, and I want to know how many lines I actually have... 09:16:39 AM all 2.00 0.00 4.00 0.00 0.00 0.00 0.00 0.00 94.00 09:16:40 AM all 5.00 0.00 0.00 4.00 0.00 0.00 0.00 0.00 91.00 09:16:41 …

linux bash command-line scripting
How to get a list of user accounts using the command line in MySQL?

I'm using the MySQL command line utility and can navigate through a database. Now I need to see a list …

mysql command-line mysql5
List all environment variables from the command line

Is it possible to list all environment variables from a Windows' command prompt? Something equivalent to PowerShell's gci env: (or …

windows command-line environment-variables prompt
How can I get the current date and time in the terminal and set a custom command in the terminal for it?

I have to check the time in a Linux terminal. What is the command for getting date and time in …

linux command-line terminal