Most Popular

1500 questions
131
votes
2 answers

What is a tainted Linux kernel?

Under certain conditions, the Linux kernel may become tainted. For example, loading a proprietary video driver into the kernel taints the kernel. This condition may be visible in system logs, kernel error messages (oops and panics), and through…
bwDraco
  • 3,273
  • 3
  • 16
  • 16
131
votes
6 answers

How to run a command that involves redirecting or piping with sudo?

I am trying to follow what I assume is best practices of using sudo instead of root account. I am running a simple concat file operation such as: sudo echo 'clock_hctosys="YES"' >> /etc/conf.d/hwclock This fails as to the right of the ">>" it is…
DarkSheep
  • 1,886
  • 3
  • 15
  • 18
130
votes
14 answers

Linux ls to show only file name, date, and size

How can I use ls on Linux to get a listing of files with only their name, date, and size? I don't need to see the other info such as owner or permissions Is this possible?
Pinkie
  • 1,403
130
votes
4 answers

How to rsync a directory to a new directory with different name?

I'm doing a data transfer, the old file system relies deeply on a directory which now is on different path. This is a git directory which stores code online. I have no rights to move it or rename it. So what I can do is rsync this directory to the…
Zen
  • 7,537
130
votes
12 answers

how to rename multiple files by replacing string in file name? this string contains a "#"

https://serverfault.com/questions/70939/how-to-replace-a-text-string-in-multiple-files-in-linux https://serverfault.com/questions/228733/how-to-rename-multiple-files-by-replacing-word-in-file-name https://serverfault.com/questions/212153/replace-stri…
Leon Francis Shelhamer
130
votes
2 answers

`find` with multiple `-name` and `-exec` executes only the last matches of `-name`

When I'm using find . -type f -name "*.htm*" -o -name "*.js*" -o -name "*.txt" it finds all the types of file. But when I add -exec at the end: find . -type f -name "*.htm*" -o -name "*.js*" -o -name "*.txt" -exec sh -c 'echo "$0"' {} \; it seems…
jakub.g
  • 3,263
  • 5
  • 21
  • 18
130
votes
3 answers

SSH: tunnel without shell on ssh server

I have to set up a tunnel between two hosts. For this I use ssh in this way: ssh -L MY_LOCAL_PORT:FOREIGN_ADDRESS:FOREIGN_PORT MYUSER@SSH_SERVER after that, I log in to my SSH_SERVER. How can I avoid this feature?! I have only to set up a tunnel. I…
Bau Miao
  • 1,523
129
votes
12 answers

Sorting files according to size recursively

I need to find the largest files in a folder. How do I scan a folder recursively and sort the contents by size? I have tried using ls -R -S, but this lists the directories as well. I also tried using find.
user2179293
  • 1,823
129
votes
13 answers

Show sum of file sizes in directory listing

The Windows dir directory listing command has a line at the end showing the total amount of space taken up by the files listed. For example, dir *.exe shows all the .exe files in the current directory, their sizes, and the sum total of their sizes.…
MattDMo
  • 2,384
129
votes
2 answers

How can I start the python SimpleHTTPServer on port 80?

I am using this command on Ubuntu but it is starting on port 8080 and I don't have another server running so I'd like it to start on port 80. I saw ways that you could set up a bash script to do something like this, but isn't there a command line…
cwd
  • 45,389
129
votes
10 answers

Set the default kernel in GRUB

How can I pick which kernel GRUB 2 should load by default? I recently installed a Linux real-time kernel and now it loads by default. I'd like to load the regular one by default. So far I only managed to pick the default OS... and for some reason…
TomTom
  • 2,603
  • 6
  • 18
  • 23
128
votes
3 answers

Why does /etc/resolv.conf point at 127.0.0.53?

I tried to check what my DNS resolver is and I noticed this: user@ubuntu:~$ cat /etc/resolv.conf nameserver 127.0.0.53 options edns0 I was expecting 192.168.1.1, which is my default gateway, my router. I don't understand why it points at…
HelloWorld
  • 1,555
128
votes
4 answers

tmux bottom status bar color change

I recently started to use tmux and like it much, but its green bottom bar is a bit distracting, is there a way to change its color? or a way to hide it?
Sam
  • 2,488
128
votes
3 answers

What does it mean to have a $"dollarsign-prefixed string" in a script?

I just saw this in an init script: echo $"Stopping Apache" What is that dollar-sign for? My research so far: I found this in the bash manual: extquote If set, $'string' and $"string" quoting is performed within ${parameter} expansions enclosed in…
Ed Brannin
  • 1,383
128
votes
4 answers

Why does parameter expansion with spaces without quotes work inside double brackets "[[" but not inside single brackets "["?

I'm confused with using single or double brackets. Look at this code: dir="/home/mazimi/VirtualBox VMs" if [[ -d ${dir} ]]; then echo "yep" fi It works perfectly although the string contains a space. But when I change it to single…
Majid Azimi
  • 3,098