Most Popular

1500 questions
137
votes
4 answers

Unlimited history in zsh

In zsh, I want to have unlimited history. I set HISTSIZE=, which works in bash. Now I import an old history mv old_history .history which is pretty big wc -l .history 43562 .history If I now close and start zsh again, I see wc -l .history 32234…
pfnuesel
  • 5,837
137
votes
5 answers

How to ssh to remote server using a private key?

I have two servers. Both servers are in CentOS 5.6. I want to SSH from Server 1 to Server 2 using a private key I have (OpenSSH SSH-2 Private Key). I don't know how to do it over unix. But what I did on windows using Putty was to feed my OpenSSH…
137
votes
10 answers

How to get scp to copy the file instead of its symlink

I want to scp a file to a server. The file is a symbolic link, and actually what I want to do is copy the source file. I don't want to track the source file's path manually, because it can be replaced. How do I get the source file's absolute path so…
Eonil
  • 4,657
137
votes
3 answers

How to renew an expired keypair with gpg

What is the best way to renew a gpg key pair when it got expired and what is the reason for the method? The key pair is already signed by many users and available on public servers. Should the new key be a subkey of the expired private key? Should…
Jonas Stein
  • 4,078
  • 4
  • 36
  • 55
137
votes
4 answers

What's the difference between $@ and $*

According to this page, $@ and $* do pretty much the same thing: The $@ holds list of all arguments passed to the script. The $* holds list of all arguments passed to the script. After searching all the top hits in google, I'm not able to find…
spuder
  • 18,053
136
votes
7 answers

How can I look up a username by id in linux?

The command id can be used to look up a user's uid, for example: $ id -u ubuntu 1000 Is there a command to lookup up a username from a uid? I realize this can be done by looking at the /etc/passwd file but I'm asking if there is an existing command…
cwd
  • 45,389
136
votes
10 answers

How can I keep my SSH sessions from freezing?

I have ServerAliveInterval and in case of few machines also ClientAliveInterval set to 540 in SSH client/server configuration files (I suppose setting it to more than that would not be a good idea). I work with many SSH sessions which currently…
syntagma
  • 12,311
135
votes
17 answers

Easy way to determine the virtualization technology of a Linux machine?

I have command line access to a Linux machine which may or may not be virtualized. I want to determine what kind of virtualization technology it runs on, if any (VMWare, VirtualBox, KVM, OpenVZ, Xen, ). This isn't a hostile environment: I'm not…
135
votes
3 answers

How do you use output redirection in combination with here-documents and cat?

Let's say I have a script that I want to pipe to another command or redirect to a file (piping to sh for the examples). Assume that I'm using bash. I could do it using echo: echo "touch somefile echo foo > somefile" | sh I could also do almost the…
strugee
  • 14,951
135
votes
8 answers

Why is there no "Euro English" locale?

I used to use the somewhat whimsical en_DK.UTF-8 locale when installing a new system because that would produce (roughly) the locale results I wanted, even though I am not in Denmark. Measurements metric Sensible date and time formats, but day and…
tripleee
  • 7,699
135
votes
10 answers

How to determine CentOS version?

How do I determine the version of a CentOS server without access to any graphical interface? I've tried several commands: # cat /proc/version Linux version 2.6.18-128.el5 (mockbuild@hs20-bc1-7.build.redhat.com) (gcc version 4.1.2 20080704 (Red Hat…
135
votes
3 answers

gpg: keyserver receive failed: No dirmngr

While trying to receive keys in my Debian Stretch server, I get this error: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF Executing: /tmp/apt-key-gpghome.4B7hWtn7Rm/gpg.1.sh…
135
votes
1 answer

How to make tmux count windows starting from 1 instead of 0?

I was able to make GNU Screen start counting windows with the number 1 instead of the default 0 with this code in my .screenrc: # Get rid of screen 0 bind c screen 1 bind ^c screen 1 bind 0 select 10 When I created windows in .screenrc I used…
hekevintran
  • 3,633
  • 3
  • 14
  • 9
135
votes
8 answers

How do I find out which processes are preventing unmounting of a device?

Sometimes, I would like to unmount a usb device with umount /run/media/theDrive, but I get a drive is busy error. How do I find out which processes or programs are accessing the device?
Stefan
  • 25,300
135
votes
7 answers

Using --exclude with the du command

This is probably something basic but I'm not able to make it work. I'm trying to use DU to get a total size of files minus certain directories. I need to exclude one specific directory called uploads but not every directory called uploads. For…
Will
  • 1,453