Most Popular

1500 questions
79
votes
7 answers

Parenthesis in expr arithmetic: 3 * (2 + 1)

expr does not seem to like parenthesis (used in mathematics to explicit operator priority): expr 3 * (2 + 1) bash: syntax error near unexpected token `(' How to express operator priority in bash?
79
votes
3 answers

How do I find out if my wireless card supports 5 GHz?

I have the 03:00.0 Network controller: Intel Corporation Centrino Wireless-N 2200 (rev c4) How do I find out if that card/driver support 5 GHz?
Evan Carroll
  • 30,763
  • 48
  • 183
  • 315
79
votes
2 answers

Will Linux start killing my processes without asking me if memory gets short?

I was running a shell script with commands to run several memory-intensive programs (2-5 GB) back-to-back. When I went back to check on the progress of my script I was surprised to discover that some of my processes were Killed, as my terminal…
NeutronStar
  • 1,671
79
votes
3 answers

How do I run 32-bit programs on a 64-bit Debian/Ubuntu?

I have a 64-bit (amd64 a.k.a. x86_64) Debian or Ubuntu installation. I need to run 32-bit (i386/i686) programs occasionally, or to compile programs for a 32-bit system. How can I do this with a minimum of fuss? Bonus: what if I want to run or test…
79
votes
5 answers

Is it possible to save as root from nano after you've forgotten to start nano with sudo?

A lot of the time I edit a file with nano, try to save and get a permission error because I forgot to run it as root. Is there some quick way I can become root with sudo from within the editor, without having to re-open and re-edit the file?
Kit Sunde
  • 4,504
  • 10
  • 31
  • 34
79
votes
4 answers

echo bytes to a file

I'm trying to connect my rasberry Pi to some display using the i2c bus. To get started I wanted to manually write stuff, bytes in particular to a file. How do you write specific bytes to a file? I already read that one and I figured my problem…
Mark
  • 1,169
79
votes
5 answers

Becoming root from inside Vim

Sometimes I start editing configuration files in /etc using Vim, but forget to use sudo to start Vim. The inevitable result then is that after finishing my edits I encounter the dreaded notice that I don't have the permission to save the file.…
79
votes
9 answers

How to find out which file is currently opened in vim?

This may sound trivial but, on more than one occasion, I have found myself having forgotten which file in vim I have open (e.g. when I am looking through different log files and such) and the only way I knew how to find out was to close the file and…
amphibient
  • 12,472
  • 18
  • 64
  • 88
79
votes
4 answers

How to find power draw in watts?

I've been asked to estimate the power consumption of the servers I run for my laboratory. I thought that I'd ask if there was some handy Linux commandline to get the power consumption of the server. It looks like powertop is useful for minimizing…
79
votes
1 answer

How do I force remove a package in Arch with pacman?

How do I force remove a package in Arch with pacman while other packages still depend upon it. pacman -R perl-libwww checking dependencies... error: failed to prepare transaction (could…
xenoterracide
  • 59,188
  • 74
  • 187
  • 252
78
votes
11 answers

How can I reliably get the operating system's name?

Say I am logged into a remote system, how can I know what it's running? On most modern Linuxes (Linuces?), you have the lsb_release command: $ lsb_release -ic Distributor ID: LinuxMint Codename: debian Which as far as I can tell just…
terdon
  • 242,166
78
votes
6 answers

Unzip file contents, but without creating archive folder

I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Well, when I use the "unzip myarchive.zip" command, the system creates a directory by default called…
78
votes
3 answers

OpenSSH: How to end a match block

I'm using a Match block in OpenSSH's /etc/ssh/sshd_config (on debian) to restrict some users to SFTP: # my stuff Match group sftponly X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp -u 0002 ChrootDirectory %h As…
mreithub
  • 3,583
78
votes
3 answers

Shebang line with `#!/usr/bin/env command --argument` fails on Linux

I've got a simple script: #!/usr/bin/env ruby --verbose # script.rb puts "hi" On my OSX box, it runs fine: osx% ./script.rb hi However, on my linux box, it throws an error linux% ./script.rb /usr/bin/env: ruby --verbose: No such file or…
rampion
  • 1,659
78
votes
3 answers

sshfs mount, sudo gets permission denied

I am using sshfs to mount a folder with some python projects over ssh to my ~/ directory. $ mkdir -p ~/mount/my-projects $ sshfs user@example.com:/home/user/my-projects ~/mount/my-projects I can perform most commands as could be expected: $ ls…