Most Popular

1500 questions
134
votes
5 answers

Grep: how to add an "OR" condition?

How can I introduce a conditional OR into grep? Something like, grepping a file's type for (JPEG OR JPG), and then sending only those files into the photos folder. For example. I know how to send the file where I want it, and get the file type, I…
Harv
  • 1,792
  • 2
  • 12
  • 19
134
votes
1 answer

Attach to different windows in session

I have a pretty simple tmux session running with two open windows; one of them for local hacking and one of them for work. What I'd like to do is to simply connect to the hacking window while leaving the work window open in another terminal.…
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311
134
votes
13 answers

How can I tell what version of Linux I'm using?

Often times I will ssh into a new client's box to make changes to their website configuration without knowing much about the server configuration. I have seen a few ways to get information about the system you're using, but are there some standard…
cwd
  • 44,479
  • 71
  • 146
  • 167
133
votes
5 answers

last time file opened

Is it possible to get the time when file was opened last time and sort all files in a directory by those times?
student
  • 17,875
  • 31
  • 103
  • 169
133
votes
8 answers

Which is the safest way to get root privileges: sudo, su or login?

I would like to have the root account in safety even if my unprivileged user is compromised. On Ubuntu you can only use sudo for "security reasons" by default. However I am not sure it is any safer than just using login on a text-mode console. There…
stribika
  • 5,374
  • 5
  • 30
  • 35
133
votes
4 answers

How do you do a dry run of rm to see what files will be deleted?

I want to see what files will be deleted when performing an rm in linux. Most commands seem to have a dry run option to show just such information, but I can't seem to find such an option for rm. Is this even possible?
Cory Klein
  • 18,391
  • 26
  • 81
  • 93
133
votes
9 answers

How do I get bash completion for command aliases?

I am looking to get tab-completion on my command line aliases, for example, say I defined the following alias : alias apt-inst='sudo aptitude install' Is there a way to get the completions provided by aptitude when I hit the tab key? i.e. when I…
levesque
  • 3,775
  • 5
  • 20
  • 15
133
votes
14 answers

Replace string in a huge (70GB), one line, text file

I have a huge (70GB), one line, text file and I want to replace a string (token) in it. I want to replace the token , with another dummy token (glove issue). I tried sed: sed 's///g' < corpus.txt > corpus.txt.new but the output…
Christos Baziotis
  • 1,457
  • 3
  • 13
  • 10
133
votes
3 answers

gpg: keyserver receive failed: No dirmngr

While trying to receive keys in my Debian Stretch server, I get this error: sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF Executing: /tmp/apt-key-gpghome.4B7hWtn7Rm/gpg.1.sh…
Hunter.S.Thompson
  • 8,839
  • 7
  • 26
  • 41
133
votes
36 answers

Quick directory navigation in the bash shell

I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/. But I don't want to type cd /[full-path]/ all the time. Are there any shortcut commands to…
saiy2k
  • 1,593
  • 3
  • 11
  • 10
133
votes
12 answers

Is there a simple linux command that will tell me what my display manager is?

Is there a simple linux command that will tell me what my display manager is? I'm using Xfce. Are different desktop environments usually affiliated with different display managers?
ptrcao
  • 5,455
  • 11
  • 36
  • 44
133
votes
17 answers

Getting tmux to copy a buffer to the clipboard

I am trying to figure out a decent way to copy what I have in a tmux buffer into my clipboard. I have tried a couple of different things like bind-key p select-pane -t 2 \; split-window 'xsel -i -b' \; paste-buffer which gets me fairly close, all…
Digital Powers
  • 1,817
  • 4
  • 14
  • 11
132
votes
7 answers

Why is there no "Euro English" locale?

I used to use the somewhat whimsical en_DK.UTF-8 locale when installing a new system because that would produce (roughly) the locale results I wanted, even though I am not in Denmark. Measurements metric Sensible date and time formats, but day and…
tripleee
  • 7,506
  • 2
  • 32
  • 42
132
votes
8 answers

How do I find out which processes are preventing unmounting of a device?

Sometimes, I would like to unmount a usb device with umount /run/media/theDrive, but I get a drive is busy error. How do I find out which processes or programs are accessing the device?
Stefan
  • 24,830
  • 40
  • 98
  • 126
132
votes
6 answers

Confusing use of && and || operators

I was skimming through an /etc/rc.d/init.d/sendmail file (I know this is hardly ever used, but I'm studying for an exam), and I've become a bit confused about the && and the || operators. I've read where they can be used in statements such as: if […
josh-cain
  • 1,781
  • 3
  • 16
  • 13