Most Popular
1500 questions
86
votes
4 answers
What does size of a directory mean in output of 'ls -l' command?
What does size of a directory mean in output of ls -l command?
Hemant
- 6,834
- 5
- 38
- 42
86
votes
4 answers
Using OR patterns in shell wildcards
Contents of my dir are
$ ls -lrt
total 0
-rw-r--r-- 1 user1 admin 19 Oct 8 12:31 night.txt
-rw-r--r-- 1 user1 admin 19 Oct 8 12:31 noon.txt
-rw-r--r-- 1 user1 admin 38 Oct 8 12:31 day.txt
I would like to list out details of files that have a…
mtk
- 26,802
- 35
- 91
- 130
86
votes
3 answers
What happens when you delete a hard link?
If you do rm myFile where myFile is a hard link, what happens?
trusktr
- 4,035
- 7
- 29
- 34
86
votes
6 answers
How can I safely remove a SATA disk from a running system?
I sometimes need to plug a disk into a disk bay. At other times, I have the very weird setup of connecting a SSD using a SATA-eSATA cable on my laptop while pulling power from a desktop.
How can I safely remove the SATA disk from the system? This…
Lekensteyn
- 20,173
- 18
- 71
- 111
86
votes
8 answers
Multiple arguments in shebang
I am wondering whether there is a general way of passing multiple options to an executable via the shebang line (#!).
I use NixOS, and the first part of the shebang in any script I write is usually /usr/bin/env. The problem I encounter then is that…
Rastapopoulos
- 1,569
- 1
- 10
- 21
86
votes
4 answers
How to run a script with systemd right before shutdown?
What do I need to put in the [install] section, so that systemd runs /home/me/so.pl right before shutdown and also before /proc/self/net/dev gets destroyed?
[Unit]
Description=Log Traffic
[Service]
ExecStart=/home/me/so.pl
[Install]
?
sid_com
- 1,531
- 3
- 16
- 20
86
votes
7 answers
Are threads implemented as processes on Linux?
I'm going through this book, Advanced Linux Programming by Mark Mitchell, Jeffrey Oldham, and Alex Samuel. It's from 2001, so a bit old. But I find it quite good anyhow.
However, I got to a point when it diverges from what my Linux produces in the…
user147505
86
votes
7 answers
Bring down and delete bridge interface that's up
How do I remove a bridge that has an IP address that was brought up manually and isn't in /etc/network/interfaces?
$ ifconfig br100
br100 Link encap:Ethernet HWaddr 00:00:00:00:00:00 …
Lorin Hochstein
- 8,077
- 17
- 50
- 56
86
votes
3 answers
What is the 6th character of the password hash on Linux, and why is it often a slash?
On Linux, what is the sixth character of the password hash stored in /etc/shadow?
On my puppy style linux box, if I try to generate 100 random passwords using shuf and /dev/urandom, then the sixth character is / about half the time.
My question is…
insecure
- 761
- 5
- 5
86
votes
8 answers
How to delete line with echo?
I know that I could delete the last three chars with:
echo -ne '\b\b\b'
But how can I delete a full line? I mean I don't want to use:
echo -ne…
LanceBaynes
- 39,295
- 97
- 250
- 349
86
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
- 2,101
- 2
- 10
- 10
86
votes
5 answers
Run multiple commands and kill them as one in bash
I want to run multiple commands (processes) on a single shell. All of them have own continuous output and don't stop. Running them in the background breaks Ctrl-C. I would like to run them as a single process (subshell, maybe?) to be able to stop…
user1876909
- 962
- 1
- 6
- 9
86
votes
3 answers
Joining bash arguments into single string with spaces
I'm trying to join all of the arguments to a Bash function into one single string with spaces separating each argument. I also need to have the string include single quotes around the whole string.
Here is what I have so…
Schwagmister
- 993
- 1
- 7
- 6
86
votes
5 answers
How to put a newline special character into a file using the echo command and redirection operator?
I would like to create a file by using the echo command and the redirection operator, the file should be made of a few lines.
I tried to include a newline by "\n" inside the string:
echo "first line\nsecond line\nthirdline\n" > foo
but this way no…
Abdul Al Hazred
- 25,760
- 23
- 64
- 88
86
votes
5 answers
why would curl and wget result in a 403 forbidden?
I try to download a file with wget and curl and it is rejected with a 403 error (forbidden).
I can view the file using the web browser on the same machine.
I try again with my browser's user agent, obtained by http://www.whatsmyuseragent.com. I do…
starfry
- 7,302
- 6
- 47
- 69