Most Popular
1500 questions
95
votes
3 answers
How do I recover from the Heartbleed bug in OpenSSL?
CVE-2014-0160 a.k.a. Heartbleed is a vulnerability in OpenSSL. It looks scary.
How do I determine whether I am affected?
If I'm affected, what do I need to do? Apparently upgrading isn't enough.
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
95
votes
13 answers
bash: test if $WORD is in set
I am looking for a construct in bash, to decide if a variable $WORD is one of defined words. I need something like this:
if "$WORD" in dog cat horse ; then
echo yes
else
echo no
fi
does bash have such construct? If not, what would be the…
Martin Vegter
- 69
- 66
- 195
- 326
95
votes
8 answers
Make a symbolic link to a relative pathname
I can do this:
$ pwd
/home/beau
$ ln -s /home/beau/foo/bar.txt /home/beau/bar.txt
$ readlink -f bar.txt
/home/beau/foo/bar.txt
But I'd like to be able to do this:
$ pwd
/home/beau
$ cd foo
$ ln -s bar.txt /home/beau/bar.txt
$ readlink -f…
Humphrey Bogart
- 1,521
- 1
- 11
- 7
94
votes
15 answers
Best way to search through shell's history
Is there a better way to search my history file for a command than grep? I do have some idea what the command starts as, but I don't know how far back in the history it is.
update: was formerly zsh specific but due to overlapping answers feel free…
xenoterracide
- 57,918
- 74
- 184
- 250
94
votes
5 answers
Splitting string by the first occurrence of a delimiter
I have a string in the next format
id;some text here with possible ; inside
and want to split it to 2 strings by first occurrence of the ;. So, it should be: id and some text here with possible ; inside
I know how to split the string (for instance,…
gakhov
- 1,095
- 2
- 8
- 9
94
votes
2 answers
How to display the Linux kernel command line parameters given for the current boot?
In the grub.conf configuration file I can specify command line parameters that the kernel will use, i.e.:
kernel /boot/kernel-3-2-1-gentoo root=/dev/sda1 vga=791
After booting a given kernel, is there a way to display the command line parameters…
colemik
- 1,361
- 2
- 11
- 11
94
votes
8 answers
Nano - jump to end of file
I have some long log files. I can view the last lines with tail -n 50 file.txt, but sometimes I need to edit those last lines.
How do I jump straight to the end of a file when viewing it with nano?
payloc91
- 2,269
- 2
- 9
- 12
94
votes
6 answers
Create partition aligned using parted
I'm partitioning a non-SSD hard disk with parted because I want a GPT partition table.
parted /dev/sda mklabel gpt
Now, I'm trying to create the partitions correctly aligned so I use the following command to know where the first sector…
Marc
- 1,651
- 3
- 14
- 16
94
votes
3 answers
How to rsync multiple source folders
I want to rsync multiple sources and I wonder the best way to achieve that.
e.g.
/etc/fstab
/home/user/download
I thought about 3 solutions :
Solution 1
multiple call to rsync
rsync -a /etc/fstab bkp
rsync -a /home/user/download bkp
con : harder…
user1437346
- 1,071
- 1
- 8
- 5
94
votes
3 answers
Can sed save its output to a file?
> can do it.
echo "text" > file
tee can do it.
echo "test" | tee file
Can sed do it without using either of the above? Is it possible to save the output of a sed command to a file without using either > or tee?
Folaht
- 962
- 5
- 21
- 36
94
votes
3 answers
Awesome symbols and characters in a bash prompt
I just ran across a screenshot of someone's terminal:
Is there a list of all of the characters which can be used in a Bash prompt, or can someone get me the character for the star and the right arrow?
Naftuli Kay
- 38,686
- 85
- 220
- 311
94
votes
2 answers
How to limit a process to one CPU core in Linux?
How to limit process to one cpu core ?
Something similar to ulimit or cpulimit would be nice. (Just to ensure: I do NOT want to limit percentage usage or time of execution. I want to force app (with all it's children, processes (threads)) to use one…
Grzegorz Wierzowiecki
- 13,865
- 23
- 89
- 137
94
votes
7 answers
Why do hard links exist?
I know what hard links are, but why would I use them? What is the utility of a hard link?
Luc M
- 4,025
- 5
- 30
- 29
94
votes
6 answers
Understanding UNIX permissions and file types
I've never really got how chmod worked up until today. I followed a tutorial that explained a big deal to me.
For example, I've read that you've got three different permission groups:
owner (u)
group (g)
everyone (o)
Based on these three groups,…
Peter
- 1,011
- 1
- 10
- 18
94
votes
14 answers
How to rsync files between two remotes?
I would like to transfer files between two remote hosts using on local shell, but it seems rsync doesn't support synchronisation if two remotes are specified as follow:
$ rsync -vuar host1:/var/www host2:/var/www
The source and destination cannot…
kenorb
- 20,250
- 14
- 140
- 164