Tag Info

Hot answers tagged

18

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


17

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 ...


16

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 ...


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.


14

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, ...


13

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 -f <private key> way instead of the accepted answer on SO. ssh-keygen -y -f <private key> takes a private key ...


12

Are you referring to nginx_ensite and nginx_dissite?


12

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


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

You can prepend the current directory: cd ./-


9

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-_ ...


8

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


8

Look at: clusterssh


8

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 ...


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

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

'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

$^ 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 ...


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

The server has been hacked. Google "opyum team." Take server offline ASAP and restore from known-good backups.


7

You can import (execute) an SQL file using the following command: $ mysql -u user -p mydb < dump.sql If you exported your data using some tool other than mysqldump, you may have troubles restoring your dump file. I ran into such a problem when I exported the database using phpmyadmin and imported it using the command line. To export your database, you ...


6

You could always try doing 310 minutes instead.


6

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.


6

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


6

Root is root. Anything you do to try to keep track of root usage can be subverted or circumvented by someone who has root; even if you cause bash to pipe all history file entries to syslog on a secured remote server, for example, your system is only safe until the badly-behaved user figures out what you've done and disables or works around it. This is a ...


6

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


5

You can use at: $ at 10am Jul 31 2030 warning: commands will be executed using /bin/sh at> echo Hello at> <EOT> job 2 at Wed Jul 31 10:00:00 2030 $ atq 1 Sun Jul 31 10:00:00 2030 a user $ atrm 1


5

Any computer system which will be running sufficiently unmodified, after four years, that a script remains valid without modificaiton is somewhat static. Any scheduling system which assumes that one box will still be serving the same role so much later is rather optimistic. Hard disk failure or other problems would make it likely that you get to discover ...



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