mreithub
  • Member for 9 years, 2 months
  • Last seen more than 3 years ago
Change PulseAudio Input/Output from Shell?
Accepted answer
80 votes

As @Teresa-e-Junior pointed out pactl is the tool to use: First of all we might want to get the IDs of our PA sinks. On my system this is what I get: $ pactl list short sinks 0 alsa_output.pci-...

View answer
OpenSSH: How to end a match block
49 votes

It seems there is no way to explicitly end Match blocks. From the sshd_config manual page: If all of the criteria on the Match line are satisfied, the keywords on the following lines override those ...

View answer
Is there a way to tell how many times my computer has rebooted in a 24 hour period?
13 votes

System reboots are usually logged in the binary file /var/log/wtmp. The easiest way to read that file is using the last command which prints lines like this for every reboot: reboot system boot 3....

View answer
SSH public key won't send to server
6 votes

The default file names ssh is looking for are id_rsa and id_rsa.pub. If you want to use other file names, you either have to specify them in ssh_config (using the IdentityFile setting) or via the ssh ...

View answer
Securely delete files on btrfs filesystem
6 votes

Hmmm, btrfs seems to defeat all usual shredding methods... There is a mount option called nodatacow but that doesn't seem to affect already existing files. As you already have sensible files on your ...

View answer
Moving /var, /home to separate partition
5 votes

I'd personally either go with @Fabian's bind-mount solution or use symlinks: create /etc/fstab entry for the new partition (use blkid to get the right UUID for your new partition and don't forget to ...

View answer
Count running processes using wc and ps
Accepted answer
5 votes

The pipe symbol ("|") redirects the output of one program to the input of another. You however use ">" to redirect wc's output to a file named log AND at the same time want to redirect the output to ...

View answer
Strange issue with curl/lynx and non resolving domains
Accepted answer
5 votes

I think you're having the same issue as posted here: https://serverfault.com/questions/296602/dns-wildcard-and-etc-resolv-conf-problem Appending a dot to your fqdn queries should work around the ...

View answer
How to see the commands executed in another shell?
5 votes

After a quick research (and some thinking) I can give you the following list of possible options: read her bash_history. But it is usually only written on logout. askubuntu.com has a post about ...

View answer
Get the newest file from directory structure year/month/date/time
4 votes

find should suit your needs: find "/path/to/backup_dir" -type f|sort -r|head -n1 This only works if you've got (as in your example) leading zeroes on your month and day folders If you want a backup ...

View answer
Only routing certain traffic through VPN
Accepted answer
3 votes

First of all: you won't be able to route traffic to 127.x.y.z anywhere other than the local machine (ok, it might even be possible, but you'd certainly break something else in the process...) so I'd ...

View answer
Use a bash function in a pipelined command
Accepted answer
3 votes

You're executing sort twice (once to check if the parameter is supported and then to actually run it). But what you forgot about is that your first sort also reads from stdin and therefore blocks ...

View answer
With mv, possible to put a time dependence on files mv'ed?
Accepted answer
3 votes

find /path/to/dir -mtime +5 -exec mv {} /target/path/ ';' will move all files in /path/to/dir that are older than five days to /target/path. You can try this to see what will actually be executed: ...

View answer
Is there a way to share a service listening on loopback of the host with an LXC guest?
Accepted answer
3 votes

There are different ways to achieve your goal. If the guests share a virtual network (i.e. are not just bridged to the physical interface) it's easy. Just tell your services to listen on that ...

View answer
Using sed to perform substitutions in a file
3 votes

Try escaping the curly brackets: sed -ie 's/2014-[0-9]\{2\}-[0-9]\{2\}/2014-05-07/g' test

View answer
Is there any way to install freeBSD from Debian?
Accepted answer
3 votes

I couldn't find any debootstrap-like software. And there are some (probably solvable) caveats if one was planning to create one: There might be file system compatibilitiy issues debootstrap's second ...

View answer
Open kickoff via shell/script
Accepted answer
3 votes

There's a thread on the KDE forums but it doesn't seem to work (and I had to modify the command a bit: qdbus org.kde.plasma-desktop /kickoff) Another approach would be to fake a key event: right ...

View answer
Read/write access on raw NTFS image
3 votes

My experience has shown that most times it's safe to modify NTFS partitions using the ntfs-3g FUSE driver. But if you're using it a lot or if the computer hangs/gets rebooted forcefully while there's ...

View answer
Why does this work: "cp image.bin /dev/mapper/loop0p1"?
2 votes

Well as far as I know, all that cp does is open the target file in write mode write the data from the source file to the target file (not sure about the chunk size though, but that's just details) ...

View answer
Tools that monitor the network bandwidth based on IP?
2 votes

The iptables firewall can be used to achieve that. It has byte and packet counts for each filter rule. So the idea is to make a filter rule for each IP on your network. As the iptables counts are not ...

View answer
using single dash with long name
1 votes

From getopt's manpage: -a, --alternative Allow long options to start with a single '-'. Or, if we're talking about the getopt* C functions: getopt_long_only() is like getopt_long(), but '-' ...

View answer
live dd over a mounted read-only root partition
Accepted answer
1 votes

You're overwriting a mounted filesystem. As soon as the file system driver attempts to read anything from it, you're bound to end up in trouble. You'll need to make sure that as soon as you're ...

View answer
Installing and setting the default desktop environment in Debian
1 votes

Usually if you install the gnome-desktop-environment and gdm3 packages, the required dependencies will be installed and the boot loader should autostart: apt-get install gdm3 gnome-desktop-...

View answer
how to grep complex hierarcy?
1 votes

Here's how I'd do it in python. The script reads from stdin and prints to stdout. It also expects the input to match a certain format. If you've got lines that don't match that format, you'd have to ...

View answer
Is it possible to get uid table in Linux?
1 votes

reading the /etc/group file as @Chirag64 suggested will only yield the system-local user groups. You might want to use getent group (or getent passwd for the user list) instead. The output is ...

View answer
dynamic file system with hooks
1 votes

You might also want to have a look at inotify. It provides an API that listens for file system changes. You could for example use IN_CREATE to get notified each time a new file gets created in a ...

View answer
Running the linux kernel and Ubuntu on custom processor
1 votes

Whow, you've got yourself into a lot of work I suppose (It sounds like a many-year-project if you ask me). You're not actually going to do all that, right? Yes, the next step would be to write (or ...

View answer
How do I make PHP securely load files from the server root home folder on CentOS?
0 votes

I got two ideas that might solve your issue: you could create a cronjob as root (crontab -e) that copies the files you need to a folder the webserver can read. You can configure the cronjob to run ...

View answer