Linux - Reddit – Telegram
Linux - Reddit
769 subscribers
4.19K photos
207 videos
39.9K links
Stay up-to-date with everything Linux!
Content directly fetched from the subreddit just for you.

Powered by : @r_channels
Download Telegram
Exclude files when copying an entire directory

Multiple times we have come across that we need to copy an entire directory but excluding some files we don't want in the new directory. Well, we can accomplish that with RSYNC and some options easily:

rsync -av --exclude='*.out' /path/to/source/ /path/to/dest/

The above command will exclude all the files with ".out" extension.

**-a** : Recurse into directories i.e. copy all files and subdirectories.

**-v** : Verbose output.

​

Now, what if we want to send the files to another host? Well, we can use SSH:

rsync -av -e ssh --exclude='*.out' /path/to/source/ user@hostB:/path/to/dest/

I hope this will be useful for you.

https://redd.it/coigj2
@r_linux
My way to automount a samba share!

**INTRO**

I've been searching for a few weeks the best way to automount a samba share until I found this (the best?) method! The main problems were that when using fstab or a systemd mount then the whole system goes unresponsive when trying to access a mounted samba share which has gone offline (easily tested with disabling smbd on the server for few minutes and after a while you cannot even use ttys). Then I tried using autofs and experiment with various timeout options and stuff but I had the same problem. Finally, I tried an autostart noscript using `gio` (gvfs with fuse) but the performance was really bad and flatpaks apps weren't seeing the mount (had to add `override --filesystem=/run/user/1000/gvfs` and navigate to that location which isn't good).

**METHOD**

Lets say we have a server with IP [192.168.2.222](https://192.168.2.222) and a share named **pidata.**

1)Install cifs-client and smbclient (or samba-client on samba distros)

2)create file **/etc/smbcredentials** with the username and password of your samba share

username=USER
password=PASSWORD

`sudo chmod 600 /etc/smbcredentials`

3)Add to **/etc/fstab** the line

//192.168.2.222/pidata /media/pidata cifs credentials=/etc/smbcredentials,noperm,file_mode=0777,dir_mode=0777,iocharset=utf8,noauto,nofail 0 0

4) Create mount dir

`sudo mkdir /media/pidata`

5)Create executable file **/usr/local/bin/samba-mount**

#!/bin/bash
while true
do
smbup=$(smbclient -q -N -L 192.168.2.222 2> /dev/null)
smbup=$(echo $smbup | grep pidata)
if [[ -z $smbup ]]
then
umount -f -l /media/pidata &> /dev/null
else
if [[ -z $(mount | grep /media/pidata) ]]
then
mount /media/pidata &> /dev/null
fi
fi
sleep 15
done

6)Create /etc/systemd/system/samba-mount.service

[Unit]
Denoscription=Samba Mount
Wants=network.target
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/samba-mount

[Install]
WantedBy=multi-user.target

`sudo systemctl daemon-reload`

`sudo systemctl enable --now samba-mount`

**NOTES**

1)This method avoids system hangs comparing to just using just fstab or systemd mount (even autofs). However, applications which accessing files from a share which is going offline will probably break (system will be stable though).

2)Much better performance than gvfs/gio

3)Easy to show in all apps (gnome or kde) and sandboxed ones with the right permissions

4)You can avoid the fstab entry and just use the options at the mount command, but I prefer it that way in order to be able to easily mount it with terminal without needing to remember all these options

5)The options I use make the share accessible to all users but of course you can try different things.

6)At first I had added the option **users** at fstab to be able to mount it with any user, but that can lead to broken gui apps if you try to unmount a share which is down (tested with nemo), and also at many distributions only root user can run mount.cifs so better keep it that way.

7)If you change the samba-mount noscript then keep it as simple as possible. For example I was using `df -h` instead of `mount` to check if the share is already mounted, but apparently `df -h` also hangs and never finishes when the mounted share goes offline.

https://redd.it/cogxiv
@r_linux
Our Ultrasound System Power By Linux
https://redd.it/cojb96
@r_linux
Deepin/ Terminal ROOT access

Hey guys, I use Deepin as my Linux distro, and everytime I open terminal and do something I have to use 'sudo' in order to be SuperUser. Would like to know is there a way to do and gain access to use terminal as a SuperUser/Root always?

https://redd.it/colgz0
@r_linux
Keybindings with a ^ ..... what are they?

I'v been using Luke Smith's LARBS rice for I3, and I love it, but there is 1 thing I can not figure out ...

in some apps, there are keybindings with a \^

​

\^B \^t \^F and similar on newsboat, neomutt, etc, and I have tried every possible key and nothing works ... what is the \^ prefix on the keybinding? what key sequence am I supposed to push?

https://i.redd.it/dfguffzcgof31.png

https://redd.it/comuu9
@r_linux
A simple unified keyboard automation tool for Wayland, X11, and Console

Introducing Hawck ([GitHub](https://github.com/snyball/Hawck).)

Linux with all it's combinations of window managers, display servers and desktop environments needs a key-rebinding system that works everywhere, and is simple to use.

Hawck intercepts key presses and lets you write Lua noscripts to perform actions or modify keys depending on your needs (see the GitHub page if you're running Wayland and are concerned about security.)

Your keyboard bindings will work on Wayland, X11, and every WM/DE you throw at them, as well as console ttys.

The ultimate goal of the project is to serve as a user-friendly Linux alternative to AutoHotkey, but this time with a sane noscripting language.

Want to make the caps lock key more useful, by binding it to control or escape?

key "caps" => replace "escape"
-- , or
key "caps" => replace "control"

Want to rebind caps-lock, but conditionally?

-- Pressing F7 will activate the replacement, and pressing F7
-- again will disable it.
mode("Caps => Ctrl mode", down + key "f7") + -up => {
key "caps" => replace "control"
}

Want to paste into a console tty, or a program that doesn't support pasting?

function getClipboard()
-- get-clipboard should be replaced with whatever works with your setup.
local p = io.popen("get-clipboard")
local clip = p:read("*a")
p:close()
return clip
end

shift + alt + key "v" => function ()
local clip_contents = getClipboard()
write(clip_contents)() -- Note the extra parens, write() returns a closure
end

Want to write "Hello" 10 times followed by a notification saying "World"? For, uh, some reason?

-- Note: down means that this will only activate when a key is pressed down.
-- You can also say `up + key "F12"` to activate on key-release, or
-- `-up + key "F12"` to activate on key-press and key-repeat.
down + key "F12" => (write "Hello ") * 10 .. say "World"

The noscripting language tries not to stray away from regular Lua syntax, but the extra operator `=>` was added.

More examples can be found on the GitHub page.

# How stable is it?

I've been running the master branch for a year without any problems. Your mileage may of course vary, depending on what you end up using it for.

Note that the Hawck GTK3 UI is still in an alpha state, and has a few unfinished/placeholder features, including "Simple Rebind." I've kept the "Simple Rebind" UI to get feedback on it.

# How do I install it?

Download or clone the git repo, and run the \`install.sh\` program from the command line (IMPORTANT: Don't use the .desktop file, you currently need to do it from the terminal.) This noscript has been tested for Ubuntu 18.04.

You will need to reboot the computer after running the installer, because it needs to add your user to a new group (with Ubuntu it seems like logging out and back in isn't enough.)

When you've started the computer back up again, run the following commands:

$ sudo systemctl start hawck-inputd
$ hawck-macrod
$ hawck-ui

PS: There is a known bug that sometimes causes \`hawck-ui\` to hang on startup, in that case, try agin.

Important note for people using sway, i3, openbox and similar minimal WMs: You need to have a [Polkit Authentication Agent](https://wiki.archlinux.org/index.php/Polkit#Authentication_agents) running to use the UI.

Move over to the settings tab, and change your keymap (this will hopefully be done automatically soon.)

You can now move on to the "Edit noscripts" tab and attempt to edit/enable the default test noscript.

If you want to keep using Hawck, and want to have it start up automatically, move over to Settings and click the autostart toggle button, you will be prompted for your password.

# I don't like the UI, can I use Hawck without it?

Sure.

To enable a noscript, create a symlink like so: `~/.config/hawck/enabled-s
cripts/my-noscript.lua -> ~/.config/hawck/noscripts/my-noscript.lua`.

When you save a noscript in your editor, `hawck-macrod` will automatically reload it.

This currently means that you will not be able to use the `=>` operator. See the GitHub page for how the (very simple) translation is made.

# Why did you call it Hawck, don't you know how to spell?

The name Hawck is a portmanteau of "Hack" and "AWK." The noscripting language takes inspiration from AWK, and the whole project started out as a bit of a hack.

# Planned features

* Key-bindings made for a specific keyboard, so that users can turn their second keyboard into a macro-board.
* Sharing the keyboard between multiple machines (there are tools that do this, but AFAIK not on Wayland.)

https://redd.it/condg8
@r_linux
Best apps for college student

I am running the latest ubuntu. I have found open office as a solid replacement for office. What other applications do you recommend for a college student?

https://redd.it/coraee
@r_linux
Submit your first Linux kernel patch in 6 minutes

I've recently looked into getting more into kernel development and found a lot of the information and guides out there quite verbose and confusing. I *hopefully* made a developer friendly article on how to hit the ground running on sending a kernel patch.

[https://medium.com/@adamzerella/how-to-become-a-linux-kernel-developer-20774c72ab07](https://medium.com/@adamzerella/how-to-become-a-linux-kernel-developer-20774c72ab07)

Let me know if anybody finds this type of content useful!

https://redd.it/cosb0x
@r_linux
Is it bad that i use kali linux?

Like i wanted to learn cyber security and since i used debian in the past kali looked good but now eveybody calls me an idiot 12 year old try hard. Is kali linux bad or something???

https://redd.it/cosipu
@r_linux
Stuck on step 1

I am complete Linux noob but I decided to dual boot on Windows 7 laptop (msi cx500 - intel/ati radeon).

MX live USB gives me a fatal error: no block device found

Ubuntu, Mint and Manjaro Live freeze to a black screen after what initially seems a successful boot.

I used two different sticks, etcher and rufus (btw rufus could not download its additional files). However all those run fine on my Windows 8.1 laptop (intel/nvidia).

Finally Xubuntu booted correctly, I created ext4 partition, installed and... Grub doesn't appear, Windows starts right away.

WTF? What could I be doing wrong? Is this some hardware problem? Should I try yet another distro or what. I am stuck.

https://redd.it/cou5y3
@r_linux
Redhat was offering a proprietary office suite for linux in 1996 for $495

I had completely forgotten about this. I was telling someone the other day that none of the early office suites/word processors were free. I had to pay for Wordperfect in 1990 to get through college classes. It came with a keyboard overlay to help you learn the keybindings.

Microsoft Word and Wordstar were also paid programs. StarWriter/StarOffice was also a paid office suite which was later included as a proprietary part of Caldera Openlinux. It was later bought and became OpenOffice.

But, I complete forgot [about Redhat and Applixware](https://web.archive.org/web/19961226192012/http://www.redhat.com/news/infoworld-apx.html)

Of course, even the kernel contained the OSS/Free drivers and, if you wanted the full functionality/compatibility that was available, you [had to pay $20 to get the proprietary kernel modules](https://web.archive.org/web/19981205020952/http://www.opensound.com/linux.html)

So, things were very different in the early days of linux, but I thought I'd provide these links as a look back on the bygone days. (BTW, [you had to pay for SuSE Linux in the earliest days. You couldn't get the entire thing for free](https://web.archive.org/web/19970709042628/https://www.suse.com/)

https://redd.it/couekf
@r_linux
Where can I find info on the snap store? How is it different to ubuntu software store?

says wickr snap not found but the snap is on the snap list?

Can't install?

https://redd.it/cov6og
@r_linux