Most Popular
1500 questions
106
votes
2 answers
What does the 's' attribute in file permissions mean?
Please compare the following two lines:
-rws---r-x 1 root root 21872 2009-10-13 21:06 prg1
-rwx---r-x 1 root root 21872 2009-10-13 21:06 prg2
Does the setuid bit on prg1, along with the read and execute bits for 'other' mean that any user can…
anders
- 1,163
- 2
- 7
- 4
105
votes
9 answers
How can I detect if the shell is controlled from SSH?
I want to detect from a shell script (more specifically .zshrc) if it is controlled through SSH. I tried the HOST variable but it's always the name of the computer which is running the shell. Can I access the hostname where the SSH session is coming…
stribika
- 5,374
- 5
- 30
- 35
105
votes
6 answers
How can I create a /dev/null-like "blackhole" directory?
I would like to create a "/dev/null" directory (or a "blackhole" directory) such that any files written to it are not really written, but just disappear.
I have an application that writes out large temporary files to a directory. I have no control…
dogbane
- 29,087
- 16
- 80
- 60
105
votes
5 answers
What process created this X11 window?
Given an X11 window ID, is there a way to find the ID of the process that created it?
Of course this isn't always possible, for example if the window came over a TCP connection. For that case I'd like the IP and port associated with the remote…
Gilles 'SO- stop being evil'
- 807,993
- 194
- 1,674
- 2,175
105
votes
7 answers
Show the year while listing files in the current directory
I am working on a Red Hat server. The commands ls -l or ll giving me the date and time in format +"%b %-d %H:%M".
I want to list the files in a way where the year when each was file created would appear within the date.
How is that possible?
WAEL
- 1,509
- 4
- 11
- 16
105
votes
4 answers
Is there any way to exit "less" without clearing the screen?
Relatively often, I find myself wanting to quit less but leave what I was viewing on the screen, to refer back to. Is there any way to do this? Workarounds?
(My current workaround is to quit, then use more. So any workaround that's better than that…
Steve Bennett
- 2,203
- 6
- 21
- 25
105
votes
5 answers
Are all bash scripts compatible with `zsh`?
I'm looking to switch from bash to zsh but concerned about compatibility of bash scripts.
Are all bash scripts/functions compatible with zsh? Therefore, if that is true is zsh just an enhancement to bash?
chrisjlee
- 8,283
- 16
- 49
- 54
105
votes
1 answer
Chrome: DNS requests with random DNS names: malware?
Over the years (since 2005), I have seen logs of strange random DNS requests done, on the multiple DNS / BIND servers I have maintained.
May 7 12:13:50 1.1.1.1 named[63742]: client 1.1.1.2#24123 (verxkgiicjmcnxg): view internal: query:…
Rui F Ribeiro
- 55,929
- 26
- 146
- 227
105
votes
4 answers
How to add/remove an element to/from the array in bash?
I have an array containing some elements, but I want to push new items to the beginning of the array; How do I do that?
SecureTech
- 1,379
- 3
- 13
- 18
105
votes
8 answers
Why would I tar a single file?
At my company, we download a local development database snapshot as a db.dump.tar.gz file. The compression makes sense, but the tarball only contains a single file (db.dump).
Is there any point to archiving a single file, or is .tar.gz just such a…
gardenhead
- 1,997
- 2
- 12
- 12
105
votes
3 answers
Why does bashrc check whether the current shell is interactive?
On my Arch install, /etc/bash.bashrc and /etc/skel/.bashrc contain these lines:
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
On Debian, /etc/bash.bashrc has:
# If not running interactively, don't do anything
[ -z…
terdon
- 234,489
- 66
- 447
- 667
105
votes
12 answers
How can I turn off "middle mouse button paste" functionality in all programs?
I don't like having the middle mouse button paste, because I often end up with uncompilable code in Eclipse. How can I turn this off (in all programs)? I'm running Fedora.
derekhh
- 1,227
- 3
- 10
- 7
105
votes
8 answers
Yum: How can I view variables like $releasever, $basearch & $YUM0?
I am setting up a yum repository, and need to debug some of the URLs in the yum.conf file. I need to know why is Scientific Linux trying to grab this URL, when I was expecting it to grab another URL:
# yum install package…
Stefan Lasiewski
- 19,264
- 24
- 70
- 85
105
votes
9 answers
When would you use an additional file descriptor?
I know you can create a file descriptor and redirect output to it. e.g.
exec 3<> /tmp/foo # open fd 3.
echo a >&3 # write to it
exec 3>&- # close fd 3.
But you can do the same thing without the file descriptor:
FILE=/tmp/foo
echo a > "$FILE"
I'm…
dogbane
- 29,087
- 16
- 80
- 60
105
votes
3 answers
How can I create a virtual ethernet interface on a machine without a physical adapter?
I have a Dell XPS 13 ultrabook which has a wifi nic, but no physical ethernet nic (wlan0, but no eth0). I need to create a virtual adapter for using Vagrant with NFS, but am finding that the typical ifup eth0:1... fails with ignoring unknown…
STW
- 2,191
- 4
- 19
- 22