Most Popular

1500 questions
78
votes
1 answer

Linux LXC vs FreeBSD jail

Are there any notable differences between LXC (Linux containers) and FreeBSD's jails in terms of security, stability & performance? On first look, both approaches look very similar.
78
votes
5 answers

Pass shell variable as a /pattern/ to awk

Having the following in one of my shell functions: function _process () { awk -v l="$line" ' BEGIN {p=0} /'"$1"'/ {p=1} END{ if(p) print l >> "outfile.txt" } ' } , so when called as _process $arg, $arg gets passed as $1, and used as a…
branquito
  • 1,027
78
votes
4 answers

wget with wildcards in http downloads

I need to download a file using wget, however I don't know exactly what the file name will be. https://foo/bar.1234.tar.gz According to the man page, wget lets you turn off and on globbing when dealing with a ftp site, however I have a http url.…
spuder
  • 18,053
77
votes
1 answer

What does 2>&1 in this command mean?

I understand that this command attempts to write to nowhere or a null device but what does 2>&1 mean here? wget -q -O - http://yourwebsite.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
codecowboy
  • 3,442
77
votes
9 answers

How do I choose a graphics card for Linux?

I'm building or buying a new Linux system, and I'm trying to select the best graphics card for my needs. How do I go about making this decision? There's dozens of computer-gear review sites which drool over every detail of new graphics hardware and…
mattdm
  • 40,245
77
votes
5 answers

Show PATH in a human-readable way

I want to show my PATH environment variable in a more human-readable way. $ echo…
77
votes
8 answers

How to make bidirectional pipe between two programs?

Everyone knows how to make unidirectional pipe between two programs (bind stdout of first one and stdin of second one): first | second. But how to make bidirectional pipe, i.e. cross-bind stdin and stdout of two programs? Is there easy way to do it…
user14284
77
votes
4 answers

Reply on same interface as incoming?

I have a system with two interfaces. Both interfaces are connected to the internet. One of them is set as the default route; a side effect of this is that if a packet comes in on the non-default-route interface, the reply is sent back through the…
Shawn J. Goff
  • 46,081
77
votes
11 answers

Backspace, Tab not working in terminal (using ssh)

When I ssh into another machine with Debian with my account(with sudo permissions), my backspace key generates some awkward symbols on pressing. Also Tab & del keys don't work too. On the other hand, I also have another account on the same machine &…
gopi1410
  • 879
77
votes
11 answers

Terminating an infinite loop

I have a command that I want to have run again automatically each time it terminates, so I ran something like this: while [ 1 ]; do COMMAND; done; but if I can't stop the loop with Ctrl-c as that just kills COMMAND and not the entire loop. How…
howard
  • 1,342
  • 1
  • 11
  • 16
77
votes
3 answers

What is the difference between ~/.profile, ~/.bashrc, ~/.bash_profile, ~/.gnomerc, /etc/bash_bashrc, /etc/screenrc ...?

Answers to the questions on SO and askubuntu, along with poking through (and reading headers of) $HOME and /etc/, indicate a number of files that can be used to set environment variables, including: ~/.profile ~/.bashrc ~/.bash_profile…
Abe
  • 1,681
77
votes
6 answers

Is there ever a reason to use scp instead of rsync?

Is there a reason to use scp instead of rsync? I can see no reason for using scp ever again, rsync does everything that scp does, with more safety (can preserve symlinks etc).
mikebloch
  • 889
77
votes
5 answers

How portable are /dev/stdin, /dev/stdout and /dev/stderr?

Occasionally I need to specify a "path-equivalent" of one of the standard IO streams (stdin, stdout, stderr). Since 99% of the time I work with Linux, I just prepend /dev/ to get /dev/stdin, etc., and this "seems to do the right thing". But, for…
kjo
  • 15,339
  • 25
  • 73
  • 114
77
votes
4 answers

What's the difference of dmesg output and /var/log/messages?

AFAIK dmesg shows information about kernel and kernel modules, and /var/log/messages also shows information produced by kernel and modules. So what's the difference? Does /var/log/messages ⊂ output of dmesg? More Info that may be helpful: - There…
xanpeng
  • 5,725
77
votes
8 answers

Converting relative path to absolute path without symbolic link

Is there a Unix command to get the absolute (and canonicalized) path from a relative path which may contain symbolic links?
Benjamin
  • 1,515