Most Popular

1500 questions
85
votes
4 answers

How to turn off Wireless power management permanently

In Linux Mint 17.3 / 18 iwconfig says the power management of my wireless card is turned on. I want to turn it off permanently or some workaround on this issue. sudo iwconfig wlan0 power off works, until I reboot the laptop. Also, if I randomly…
Vlastimil Burián
  • 27,586
  • 56
  • 179
  • 309
85
votes
5 answers

Set a network range in the no_proxy environment variable

I'm in a network using a proxy. I've got machines using lots of scripts here and there accessing each other over HTTP. The network is 10.0.0.0/8. My proxy is 10.1.1.1:81, so I set it up accordingly: export http_proxy=http://10.1.1.1:81/ I want to…
SamK
  • 1,580
  • 2
  • 13
  • 14
85
votes
4 answers

Windows Managers vs Login Managers Vs Display Managers Vs Desktop Environment

I posted a question and noticed people weren't distinguishing correctly between many of these things: Windows Managers vs Login Managers Vs Display Managers Vs Desktop Environment. Can someone please clear this up, i.e. tell us the difference…
ptrcao
  • 5,455
  • 11
  • 36
  • 44
85
votes
6 answers

recursive statistics on file types in directory?

I did a website scrape for a conversion project. I'd like to do some statistics on the types of files in there -- for instance, 400 .html files, 100 .gif, etc. What's an easy way to do this? It has to be recursive. Edit: With the script that…
user394
  • 14,194
  • 21
  • 66
  • 93
85
votes
2 answers

suppress stderr messages in a bash script

Consider the following (slightly silly) script name 'test1.sh': #/bin/bash # sleep 10 & echo sleep pid = $! pkill sleep When I run it, I get not only the output of the echo, but bash's reporting of the death of sleep on stderr: $ ./test1.sh sleep…
fearless_fool
  • 1,015
  • 1
  • 7
  • 10
85
votes
6 answers

Can I configure my shell to print STDERR and STDOUT in different colors?

I want to set my terminal up so stderr is printed in a different color than stdout; maybe red. This would make it easier to tell the two apart. Is there a way to configure this in .bashrc? If not, is this even possible? Note: This question was…
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311
85
votes
5 answers

How can I tell whether a package is installed via yum in a bash script?

I am trying to write a script that installs packages, but if it fails at any point later in the script rolls back whatever it installed. Of course if the user has already previously installed a package I don't want to uninstall it out from under…
Doktor J
  • 2,622
  • 2
  • 15
  • 18
85
votes
3 answers

Why I can't escape spaces on a bash script?

I'm trying to escape the space char for a path in Bash, but neither using a backslash or quotes works. .sh script: ROOT="/home/hogar/Documents/files/" FILE=${ROOT}"bdd.encrypted" DESTINATION="/home/hogar/Ubuntu\ One/folder" mv ${FILE}…
Lucio
  • 1,267
  • 1
  • 13
  • 16
84
votes
6 answers

Delete last line from the file

I use sed to quickly delete lines with specific position as sed '1d' sed '5d' But, what if I want to delete the last line of the file and I don't know the count of lines (I know I can get that using wc and several other tricks). Currently, using…
mtk
  • 26,802
  • 35
  • 91
  • 130
84
votes
9 answers

What are the alternatives for checking open ports, besides telnet?

We can use the following in order to test telnet VIA port; in the following example we test port 6667: [root@kafka03 ~]# telnet kafka02 6667 Trying 103.64.35.86... Connected to kafka02. Escape character is '^]'. ^CConnection closed by foreign…
yael
  • 12,598
  • 51
  • 169
  • 303
84
votes
8 answers

count lines in a file

I'm sure there are many ways to do this: how can I count the number of lines in a text file? $ file.txt 1020 lines
Chris Smith
  • 951
  • 1
  • 6
  • 6
84
votes
3 answers

How to configure systemd-resolved and systemd-networkd to use local DNS server for resolving local domains and remote DNS server for remote domains?

I'm connected to local area network with access to the Internet through gateway. There is DNS server in local network which is capable of resolving hostnames of computers from local network. I would like to configure systemd-resolved and…
Piotr Dobrogost
  • 4,116
  • 5
  • 35
  • 46
84
votes
1 answer

Variable substitution with an exclamation mark in bash

I have the following lines in my .cfg bash script file DDF_SOURCE="siebel_DATA_DATE_FORMAT" DATA_DATE_FORMAT=${!DDF_SOURCE} how is ${!DDF_SOURCE} evaluated? It would be !siebel_DATA_DATE_FORMAT, which doesn't make sense to me.
van
  • 1,089
  • 1
  • 9
  • 9
84
votes
5 answers

How do I convert a ssh-keygen public key into a format that openssl PEM_read_bio_RSA_PUBKEY() function will consume?

I'm having an issue generating a public key that the openssl PEM_read_bio_RSA_PUBKEY() function can consume. I keep getting errors. Obviously I cannot simply use the ASCII string in the ssh-keygen <>.pub key file as it is in SSH file format or I…
PeteP
  • 841
  • 1
  • 7
  • 3
84
votes
5 answers

Can I change root's email address or forward it to an external address?

I'm getting a lot of mail in my root user's mail account. This appears to be mostly reports and errors from things like cron scripts. I'm trying to work though and solve these things, possibly even have them be piped to some sort of "dashboard" -…
cwd
  • 44,479
  • 71
  • 146
  • 167