Most Popular
1500 questions
70
votes
2 answers
How does SSH connection survive a network restart?
From a Linux SSH shell, type /etc/init.d/network restart to restart the network service.
I expect my SSH connection to die since the network service goes down. But it doesn't. Very cool. But how does Linux achieve this? How does it keep my SSH…

Serge Wautier
- 908
- 1
- 6
- 9
70
votes
3 answers
How to create /dev/null?
I deleted my /dev/null. How can I restore it?

LanceBaynes
- 36,957
- 90
- 243
- 345
70
votes
2 answers
Is there a whoami to find the current group I'm logged in as?
I'm trying to find my current logged in group without wanting to use newgrp to switch.

Ian F
- 1,681
- 1
- 9
- 10
70
votes
8 answers
Makefile include env file
I'm trying to include some env vars into a Makefile. The env file looks like:
FOO=bar
BAZ=quux
Note there's no leading export to each env var. If I add the leading export and just include the env file in the Makefile, everything works as it should.…

Michael Irwin
- 803
- 1
- 6
- 5
70
votes
2 answers
How can I set Vim's default encoding to UTF-8?
I'd like to contribute to an open source project by providing translated strings. One of their requirements is that contributors must use UTF-8 as the encoding for the PO files.
I'm using Vim 7.3 on Linux. How can I be sure that Vim's encoding is…

Paolo
- 16,105
- 10
- 29
- 40
70
votes
3 answers
Refresh aliases and functions after defining new aliases and functions?
When I define a new alias in .bash_aliases file or a new function in .bashrc file, is there some refresh command to be able immediately use the new aliases or functions without closing the terminal (in my case xfce4-terminal with a few tabs open,…

xralf
- 15,197
- 27
- 97
- 142
70
votes
6 answers
How to create a TCP listener?
Introduction: I have created a bash function that is able to check whether a port is available and increments it by 1 if false until a certain maximum port number. E.g., if port 500 is unavailable then the availability of 501 will be checked until…

030
- 1,417
- 2
- 17
- 33
70
votes
6 answers
Assigning exit code to a shell local variable
#!/bin/bash
function0()
{
local t1=$(exit 1)
echo $t1
}
function0
echo prints empty value. I expected:
1
Why doesn't t1 variable get assigned the exit command's return value - 1?
user93868
70
votes
5 answers
Some M4 macros don't seem to be defined
I am trying reinstall pacman on my Arch Linux distribution. When I run the configure script "configure.ac", I get a bunch of undefined macros:
error: possibly undefined macro: AM_INIT_AUTOMAKE.
If this token and others are legitimate, please use…

SirTasty
- 843
- 1
- 7
- 8
70
votes
4 answers
Why is `[` a shell builtin and `[[` a shell keyword?
As far as I know, [[ is an enhanced version of [, but I am confused when I see [[ as a keyword and [ being shown as a builtin.
[root@server ~]# type [
[ is a shell builtin
[root@server ~]# type [[
[[ is a shell keyword
TLDP says
A builtin may be…

Sreeraj
- 4,744
- 9
- 35
- 55
70
votes
9 answers
Why can't gcc find libevent when building tmux from source?
I want to install tmux on a machine where I don't have root access. I already compiled libevent and installed it in $HOME/.bin-libevent and now I want to compile tmux, but configure always ends with configure: error: "libevent not found", even…

volker
- 703
- 1
- 6
- 4
70
votes
7 answers
combine text files column-wise
I have two text files. The first one has content:
Languages
Recursively enumerable
Regular
while the second one has content:
Minimal automaton
Turing machine
Finite
I want to combine them into one file column-wise. So I tried paste 1 2 and its…

Tim
- 92,534
- 165
- 512
- 896
70
votes
7 answers
Can I find out which ssh key was used to access an account?
Is it possible to find out which ssh key was used to access an account? I have an account on a server that I let several (trusted!) people have access to via ssh. I'd find it useful to be able to know who logged in and when. I have root access so…

Andrew Stacey
- 2,275
- 3
- 19
- 21
70
votes
3 answers
What is the basic difference between Arch and Gentoo Linux?
What is the difference between Arch Linux and Gentoo Linux? Their ideologies seem quite similar to me.

Ritik
- 853
- 1
- 8
- 5
70
votes
7 answers
Making zsh default shell without root access
I am using my school's computers and would like to use zsh instead of bash. I'd like to make it the default shell, but I cannot run a command such as $ chsh -s $(which zsh) because I don't have admin privileges.
Is there a way I can put something…

goodcow
- 853
- 1
- 7
- 6