Hot answers tagged

38

If you have installed the nginx package from the Ubuntu repositories, you will have two directories. /etc/nginx/sites-enabled and /etc/nginx/sites-available. In the main nginx configuration, /etc/nginx/nginx.conf, you have the following line: include /etc/nginx/sites-enabled/*.conf; So basically to list all available virtualhosts, you can run the ...


38

Question is already answered on stackoverflow: http://stackoverflow.com/questions/274560/how-do-you-test-a-public-private-keypair (Can I mark a question as duplicate on another stackexchange network?) I would prefer the ssh-keygen -y -e -f <private key> way instead of the accepted answer on SO. ssh-keygen -y -e -f <private key> takes a private ...


33

Just create this script /usr/bin/nginx_modsite and make it executable. #!/bin/bash ## # File: # nginx_modsite # Description: # Provides a basic script to automate enabling and disabling websites found # in the default configuration directories: # /etc/nginx/sites-available and /etc/nginx/sites-enabled # For easy access to this script, ...


28

Not natively but check out: http://mridgers.github.io/clink/ , makes cmd.exe much more productive. Quoting features from the project page: Powerful Bash-like line editing from GNU's Readline library. Superior path completion (TAB). Paste from clipboard (Ctrl-V). Support for the completion of executables/commands, and environment variables. Undo/Redo (Ctrl-_ ...


24

SSH connects stdin, stdout and stderr of the remote shell to your local terminal, so you can interact with the command that's running on the remote side. As a side effect, it will keep running until these connections have been closed, which happens only when the remote command and all its children (!) have terminated (because the children, which is what "&...


21

Use the CHARACTER SET option when creating your database, like so: CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_bin; also, read the docs...


21

It's an alternative form of the 'test' command. Mostly used in scripts. i.e. if [ $VAR ] then echo $VAR exists! fi


18

This is actually dependent on your shell. Quotes (either kind) are primarily meant to deal with whitespace. For instance, the following: grep hello world file1 will look for the word "hello" in files called "world" and "file1", while grep "hello world" file1 will look for "hello world" in file1. The choice between single or double quotes is only ...


18

Are you referring to nginx_ensite and nginx_dissite?


17

If you're not too fussy about the appearance of the separator: tail -n +1 *


14

Not sure there is an answer to this when using a mouse. If you wanted a command-line way to do it, you can just echo the command and pipe that output to clip: echo stuff you wanted copied to the clipboard | clip FYI, clip is available on Windows 2003. I believe it is a built-in.


12

If database name contains nonalphanumeric chars use "`" to quote: CREATE DATABASE `my-db` CHARACTER SET utf8 COLLATE utf8_general_ci; When using in shell script quote the quotes with "\" mysql -p -e "CREATE DATABASE \`my-db\` CHARACTER SET utf8 COLLATE utf8_general_ci;"


11

No, Windows command prompt history can't be saved when a session ends.


10

Correct, [/usr]/[s]bin is for the distro creator's use. Local user scripts belong under /usr/local, specifically /usr/local/bin in this case. Filesystem Hierarchy Standard


9

Look at: clusterssh


9

You can prepend the current directory: cd ./-


8

Just do echo "my file content as a string" | my_command


8

The following command will output each line of script to Write-Debug- Set-PSDebug -Trace 1 From man Set-PSDebug When the Trace parameter is set to 1, each line of script is traced as it is executed. When the parameter is set to 2, variable assignments, function calls, and script calls are also traced. If the Step parameter is specified, you are ...


8

cd /to/your/directory; for each in *; do cat $each; echo "XXXXXXXXXXX"; done


8

$^ is a variable that expands to the last executed Powershell command. You can run a command as another user using runas, so the following works: runas /user:domain\administrator $^ To shorten that up a bit, you can do some magic with aliases. Take a look at this Technet article for more info. EDIT: One caveat - $^ only executes the first command in a ...


8

If I understand what you want to do properly, you can do it with bash's command substitution feature: foo <(somecommand | pv) This does something similar to what the mkfifo-based answers suggest, except that bash handles the details for you (and it winds up passing something like /dev/fd/63 to the command, rather than a regular named pipe). You might ...


8

rsync is a program designed to be a client and server. The server reads and the client writes. Imagine that instead of a single computer, you had computers over network, I'm sure it's lot more clear if you think that way. Then there is the controller. As IO operations tend to come with certain amount of risk, an IO issue shouldn't cause total blocking or a ...


7

'screen' - allows for detachable, re-attachable command line sessions. Made extra shiny with screen-profiles (default in Ubuntu 9.04), and byobu in 10.04


7

What problems are you having with PSExec and W2k3 exactly? We use the two together extensively, in a 500+ W2k3 server environment... In fact, the whole PSTools suite rocks my world. EDIT: This is a followup to your edit of the original ticket. The problem you're encountering is that "copy" is a function of CMD.exe. It doesn't exist as its own ...


7

James is correct, but to add some more data, I think that the best way to think about it is as arguments to the command: do you intend "hello" and "world" to be two arguments or "hello world" to be one argument. Also, doublequotes allow interpretation of more than just variables. Exactly what depends on your shell, but check into history expansion, brace ...


7

Massimo is correct that your command prompt history does not persist across sessions. You could manually grab this before closing your prompt by typing doskey /history > history.txt Or... you could use PowerShell as your CMD prompt, and follow this post to persist your history across sessions.


7

It's what you call when you are using something like if [ -e foo ]; then ... in a shell script (but most shells have it as a buildin this days). man test should give you the docs.


7

Rephrasing the question, you want to know when someone attempts to set the system time. This is exactly what the audit subsystem is for...it allows you to audit the execution of specific system calls. In this case, you want to know whenever someone calls any of the various system calls that can change the system time. By using the audit subsystem, you ...


7

There's no point in re-sourceing a new .bashrc within Puppet, because it'll run in a subshell and the changes won't propagate into your current shell (which is, I assume, what you're trying to do). You can't do what (I think) you want to do.



Only top voted, non community-wiki answers of a minimum length are eligible