Questions tagged [command]

183 questions
180
votes
10 answers

Nginx enable site command

We all know how to enable a website using apache on Linux. I'm pretty sure that we all agree on using the a2ensite command. Unfortunately, there is no default equivalent command that comes with Nginx, but it did happen that I installed some package…
HXH
  • 2,905
  • 2
  • 17
  • 13
150
votes
10 answers

Is there a global, persistent CMD history?

Sometimes I forget how the exact syntax of a CMD command looks and then I would like to search my own CMD history. Clearly, within the same session, you can browse it with the up and down arrow keys but what about the history of former CMD sessions?…
raoulsson
  • 4,633
  • 10
  • 32
  • 29
130
votes
4 answers

How to check if an RSA public / private key pair match

I have two files, id_rsa and id_rsa.pub. What command can be used to validate if they are a valid pair?
Ryan
  • 5,341
  • 21
  • 71
  • 87
51
votes
4 answers

PowerShell script, showing commands run

I am playing around with PowerShell scripts and they're working great. However, I am wondering if there is any way to also show all the commands that were run, just as if you were manually typing them in yourself. This would be similar to "echo…
Nelson Rothermel
  • 523
  • 1
  • 5
  • 9
35
votes
3 answers

Linux: cat with separators among files

In Linux if you type cat *, you will get something like this: line1 from file1 line2 from file1 line1 from file2 line1 from file3 line2 from file3 line3 from file3 What I would like is to display a separator among files. Something like this: line1…
Daniele
  • 631
  • 1
  • 7
  • 10
28
votes
4 answers

SSH authorized_keys command option: multiple commands?

The authorized_keys has a command="..." option that restricts a key to a single command. Is there a way to restrict a key to multiple commands? E.g. by having a regex there, or by editing some other configuration file?
dkaeae
  • 407
  • 1
  • 5
  • 9
28
votes
2 answers

When to use single quotes, double quotes, or no quotes in grep?

While trying to search for a simple pattern "hello" in a file, all the following forms of grep work: grep hello file1 grep 'hello' file1 grep "hello" file1 Is there a specific case where one of the above forms work but others do not. Does it make…
TheLameProgrammer
28
votes
5 answers

Pass a pipe to a command that expects a filename

Say I have a command foo which takes a filename argument: foo myfile.txt. Annoyingly, foo doesn't read from standard input. Instead of an actual file, I'd like to pass it the result of another command (in reality, pv, which will cat the file and…
Steve Bennett
  • 5,539
  • 12
  • 45
  • 57
25
votes
1 answer

Return only a HTTP status code from curl command

I want to just get a statusCode from CURL command response. When I use this command: curl -I http://uploadserver.ln/1.mp4 I want to just get 200 rather than this long result: HTTP/1.1 200 OK Server: nginx/1.14.0 (Ubuntu) Date: Sun, 01 Jul 2018…
soroush
  • 365
  • 1
  • 3
  • 6
25
votes
3 answers

What is /usr/bin/[?

I was just poking around in /usr/bin and I found an ELF binary file called [. /usr/bin/[. I have never heard of this file and my first thought was that it was a clever way of hiding a program, possibly a trojan. However it's present on all my CentOS…
Josh
  • 9,001
  • 27
  • 78
  • 124
21
votes
5 answers

Using SSH to remotely start a process

I have written a script that I am using to push and deploy a new service to several machines under my control, and in order to execute the process I am using ssh to remotely start the process. Unfortunately, whenever I use SSH to start the process,…
rmrobins
  • 335
  • 2
  • 3
  • 7
16
votes
2 answers

Command to create MySQL database with Character set UTF-8

I use create database dbname; to create database. but I want it to created with Character set UTF-8 Anyone know what is the command to use?
Komputer
15
votes
2 answers

How to print the last line of a gz compressed file in the command line?

I have a lot of gz compressed log files which have generic names and I need to check the period of time they reflect. I know about the zcat | head but this works for the beginning of the file only. How can I just get the last line without…
Jurudocs
  • 299
  • 1
  • 3
  • 11
14
votes
1 answer

Whats "Birth" field in stat command output

I'm using Fedora-16 with ext4.Suddenly with stat command I can see something called "Birth". # stat history_file1.txt File: `history_file1.txt' Size: 8944 Blocks: 24 IO Block: 4096 regular file Device: 802h/2050d …
webminal.org
  • 273
  • 5
  • 19
14
votes
2 answers

Sudo !! equivalent in PowerShell

"Sudo !!" invokes previously executed command with administrator privileges in *nix shell. Is there an equivalent in PowerShell?
BlueGene
  • 2,191
  • 9
  • 29
  • 33
1
2 3
12 13