recentpopularlog in

kme : linux   1075

« earlier - print a file slowly
This works, whereas 'slowcat.c' didn't for some reason (on macOS).
unix  linux  terminal  textprocessing  utility  software 
22 days ago by kme
Activating a volume group
CentOS 7 seems to make an LVM group by default, and that's fine. When mounting it in a recovery environment, you need to do this in order to access the data on disk:

<code class="language-bash"># vgchange -a y my_volume_group</code>
centos  centos7  linux  sysadmin  storage  lvm  solution 
24 days ago by kme
Troubleshooting the Windows Subsystem for Linux | Microsoft Docs |
Do this is an admin PowerShell
<code class="language-powershell">
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
windows  wsl  linux  virtualization  troubleshooting 
6 weeks ago by kme
Bashhub · Every command. |
Hope there are no passwords or API keys in your history.
sysadmin  linux  unix  bash  history  cloud  cloudstorage  searchengine 
7 weeks ago by kme
GNU Core Utilities Frequently Asked Questions -
<code class="language-bash"> alias del='mv --verbose --backup=simple --suffix=$(date +".(%F_%T)") --target-directory=$HOME/.Trash/'</code>

See also:
linux  storage  extfs  ext2fs  ext3fs  ext4fs  undelete  reference 
7 weeks ago by kme
GNU Core Utilities Frequently Asked Questions -
The GNU chown program will change the ownership if the operating system it is running upon allows it. If you can’t change file ownership then it is the operating system which is restricting you and not the chown program.

Actually, the GNU chown command does not know if this is the policy of the system or not. It calls the kernel system call chown() just like any other program (e.g. perl, ruby, etc.) If the OS allows it then it will change the ownership of the file. Different systems handle this differently. Traditional System V Unix systems allow anyone to give a file away to other owners. On those systems GNU chown does change the ownership of files.

But on most modern systems BSD semantics are followed and only the superuser can change the ownership of the file. The problem for documenting this is that GNU chown does not know which it will be running on. It could be one or it could be the other. Or it might even be running on a system without the concept of file ownership at all! This is really an OS policy decision and it is hard to track documentation to be different on different systems. But the documentation must be independent of operating system.

The reason an operating system needs to restrict changing ownership is mostly threefold.

A user can create files that they cannot remove. With the old semantics it was possible for normal users to create situations that only the superuser could fix, such as creating a non-writable directory of files and then giving the ownership away. Since they no longer own the files they can’t change them, nor can they remove them. This is commonly a problem when untaring files that other people created with restrictive file permissions. The new semantics avoid this problem entirely. Therefore most systems today have been changed to disallow giving file ownership away. But as noted it has not always been that way.
Additionally systems need to restrict who can remove files from system temporary directories such as /tmp. Otherwise anyone could remove any file there which might disrupt system processes. Some programs might even have security issues associated with this. Therefore modern systems set the ’sticky’ bit on /tmp. This is the ’t’ bit. On directories this prevents users from removing or renaming a file unless they own the file or directory. The reason this is important is that if chown is allowed then /tmp is another place that a file could be created by a user, chowned, and then could not be removed by the user. A sticky /tmp and a restricted chown policy go together. If you have one then you should have the other as well.
People have used this to avoid disk space quota restrictions. Give the file to someone either with disk quota to spare or without any quota restrictions, like root. You can always copy the files back and then you own them again. This effectively defeats any quota system if allowed. Also, you can deny someone else service with a denial of service attack by using all of their quota until they cannot create any files. You use up their quota by chowning files to them someplace where they cannot find them.
gnu  linux  coreutils  chown  permissions  unix  sothatswhy 
7 weeks ago by kme
retext/ at master · retext-project/retext |
hideToolBar (boolean) - whether to hide the toolbars from the UI (default: false)
tabBarAutoHide (boolean) - whether to hide the tabs bar when only one tab is open (default: false)
useFakeVim (boolean) - whether to use the FakeVim editor, if available (default: false)
retext  markdown  linux  vikeybindings  configfile  configsettings  essential  movein  solution 
7 weeks ago by kme
Unicode Utilities
This package has an open bug for being removed from Debian because it hard-codes the Unicode 5.1 standard in the binary (we're in the 12s now, so this is probably pre-emoji). Proposed alternative from this bug report (
uniname defaults to printing the character offset of each character, its byte offset, its hex code value, its encoding, the glyph itself, and its name. Command line options allow undesired information to be suppressed and the Unicode range to be added. Other options permit a specified number of bytes or characters to be skipped. For example, the default output for this text:

unidesc reports the character ranges to which different portions of the text belong. It can also be used to identify Unicode encodings (e.g. UTF-16be) flagged by magic numbers. Here is the output when given the above Japanese text as input:

ExplicateUTF8 is intended for debugging or for learning about Unicode. It determines and explains the validity of a sequence of bytes as a UTF8 encoding. Here is the output when given the above Japanese text as input:

Utf8lookup is a shell script which invokes uniname to provide an easy way to look up the character name corresponding to a codepoint from the command line. In addition to uniname it requires the utility Ascii2binary.

Unireverse is a filter that reverses UTF-8 strings character-by-character (as opposed to byte-by-byte). This is useful when dealing with text that is not encoded in the order in which you want to display it or analyze it. For example, if you want to display Arabic on a terminal window that does not support bidi text, Unirev will put it into the normal display order.

Unifuzz generates test input for programs that expect Unicode. It can generate a random string of characters, tokens of various potentially problematic characters and sequences, very long lines, strings with embedded nulls, and ill-formed UTF-8. Use it to find out whether your program reacts gracefully when given unexpected or ill-formed input.
unix  linux  unicode  textprocessing  decode  utility  sourcecode  commandline  fuckina  solution  revealcodes  nonprintingcharacters 
7 weeks ago by kme
uninames - show selected Unicode character descriptions -
Doesn't do what 'uninames' from 'uniutils' does (print names of Unicode characters from stdin), but might still be handy.
unix  linux  perl  unicode  reference 
7 weeks ago by kme
Ubuntu Manpage: uniname - Name the characters in a Unicode text file
From the 'uniutils' package, apparently (via:
uniname names the characters in a Unicode text file. For each character, uniname defaults to printing the character offset, the byte offset, the hexadecimal UTF-32 character code, the encoding as a sequence of hex byte values, the glyph, and the character's Unicode name. Command line flags allow undesired information to be suppressed. Glyphs that do not display nicely, such as control characters and spaces, are not displayed. For the Latin-1 control characters, whose official Unicode name is "control", the real name is given. Character and byte offsets both start from 0.
linux  unicode  decode  textprocessing  fuckina  solution 
7 weeks ago by kme
107583 – Linux: REGRESSION: drm: cmdline EDID override mechanisms broken since 4.15
There was a patch committed in the 5.2.x series at 48eaeb7664c76139438724d520a1ea4a84a3ed92. Did it land in 5.3, 5.4, ...?
linux  kernel  drm  kms  edid  sony  vaio  bootoption  graphics  annoyance  needshelp 
7 weeks ago by kme
upstart - How to enable or disable services? - Ask Ubuntu
(FOR UPSTART) To toggle a service from starting or stopping permanently you would need to:
<code class="language-bash">echo manual | sudo tee /etc/init/SERVICE.override</code>
upstart  systemd  ubuntu  centos  linux  sysadmin  dammitbrain  solution 
9 weeks ago by kme
Liam O 🦆 on Twitter: "Favourite thing in my .bashrc remains: alias fuck='sudo $(history -p !!)'"
Also note that this will (probably) not work with quoted arguments.
<code class="language-bash">
alias fuck='sudo $(history -p !!)'
unix  linux  sysadmin  sudo  bashrc  fuckups  humor 
9 weeks ago by kme
How do you remap a key to the Caps Lock key in Xubuntu? - Ask Ubuntu
Another way:
<code class="language-bash">sudo vi /etc/default/keyboard</code>
then find the line that starts with XKBOPTIONS, and add ctrl:nocaps to make Caps Lock an additional Control key or ctrl:swapcaps to swap Caps Lock and Control.

For example, mine looks like
code class="language-bash">XKBOPTIONS="lv3:ralt_alt,compose:menu,ctrl:nocaps"</code>
hen run
<code class="language-bash">sudo dpkg-reconfigure keyboard-configuration<code>
The reason this way is better is that it will take effect on the virtual consoles (e.g. Ctrl+Alt+F1) as well as in the graphical desktop.
linux  ubuntu  xubuntu  swapcapslockandctrl  capslock  keymap  console  solution 
10 weeks ago by kme
Better Bash history | Arabesque |
Nice, concise explanation of how to get sane Bash history settings.
linux  unix  bash  bashhistory  history  dotfiles  newbie  howto  reference 
11 weeks ago by kme
lightdm - Personalize monitor position before login - Ask Ubuntu |
<code class="language-bash">sudo cp ~/.config/monitors.xml /var/lib/lightdm/.config/</code>
linux  elementaryos  lightdm  multimonitor  annoyance  solution 
11 weeks ago by kme
SystemRescueCd - Installing SystemRescueCd on a USB stick |
Follow this method is you want to boot the USB device in UEFI mode. The idea is to create a FAT32 partition on the device where the firmware will find Grub. For the UEFI firmware to use this partition as the EFI filesystem is must have the right flags in the partition table. The USB device can have additional partitions.

- **Download** the latest SystemRescueCd ISO image from the [download page](
- **Create a msdos** disklabel on the USB device using a tool such as parted or gparted
- **Create a FAT32 partition** with at least 2GB on the USB device and set `SYSRCDXYZ` as the filesystem label
- **Set the boot and lba flags on the FAT32 partition** using a tool such as parted or gparted
- **Copy all files from the ISO image to the FAT32 partition** from a terminal with both devices mounted

In the previous steps `SYSRCDXYZ` refers to the version number, eg: `SYSRCD601` for SystemRescueCd-6.0.1.
disasterrecovery  bootable  uefi  livecd  liveusb  linux  iso  howto  solution 
11 weeks ago by kme
FAQ - btrfs Wiki
From kernel 5.0+ btrfs have native swap files support, but with some limitations. Swap file - must be fully allocated as NOCOW with no compression on one device.
linux  sysadmin  swap  swapfile  btrfs  solution 
november 2019 by kme
Parcellite indicator in Ubuntu 13.10 - Ask Ubuntu |
It seems that a fork of Parcellite is available and this fork supports does provide an indicator for Unity:

Parcellite with Ubuntu AppIndicator? ClipIt!

Links to:
linux  clipboardmanager  clipboard  history  utility  essential  alternativeto  diodon  movein 
november 2019 by kme
bash - 'man' page is too narrow (not taking advantage of terminal size) - Unix & Linux Stack Exchange
Today I learned (more 'strace' tricks):
<code class="language-bash">grep groff log | sed 's/\], \[.*//'
# result:
# 28721 execve("/usr/bin/groff", ["groff", "-mtty-char", "-Tutf8", "-mandoc", "-rLL=171n", "-rLT=171n"</code>
So, something like this will give you the line length you want (since most of the time 'man` is doing some magic to autodetect your terminal width):
<code class="language-bash">
wget -qO - \
| groff -man -Tutf8 -rLL=${COLUMNS}n \
| less
Only '-rLL=XXn' is required; the title length is inferred from that, if not otherwise specified.
unix  linux  manpage  groff  terminalwidth  solution 
november 2019 by kme
linux - Change width of man command ouput - Stack Overflow
<code class="language-bash">MANWIDTH=80
man bash</code>
unix  linux  manpage  man  80columns  solution 
november 2019 by kme
Print to STDERR in AWK - Google Groups
I forgot the quotes around "/dev/stderr" is all:
<code class="language-awk">print "foo" > "/dev/stderr"</code>
unix  linux  shellscripting  awk  errormessage  stderr  solution 
november 2019 by kme
🔎Julia Evans🔍 on Twitter: "awk… "
my current favorite is to remove duplicate lines
<code class="language-bash">awk '!seen[$0]++' filename</code>
unix  linux  shellscripting  awk  forthecomments  tipsandtricks 
october 2019 by kme
Bash trap on exit from function - Stack Overflow
Sure enough, it was right there in the docs for 'trap' (and 'return').
Yes, you can trap RETURN :
<code class="language-bash">$ function foo() {
> trap "echo finished" RETURN
> echo "doing some things"
> }</code>
unix  linux  bash  shellscripting  til  traps  solution 
october 2019 by kme
bash - How to check if a process id (PID) exists - Stack Overflow
Looks like 'ps -p $PID' is the way to go; 'kill -0 $PID' has caveats.
unix  linux  sysadmin  processmanagement  shellscripting 
october 2019 by kme
ssh agent - ssh-add under cygwin - Server Fault
I totally did this.

OK, that other answer has a typo.

The right thing you want to run is:
<code class="language-bash">eval `ssh-agent`</code>
ssh-agent spits out a bunch of shell statements to set environmental variables. The eval runs them in the current shell. You can invoke ssh-agent that way, or run ssh-agent and then copy-paste its output into your current shell for the same effect.
ssh  ssh-agent  cygwin  linux  unix  doh  solution 
october 2019 by kme
How to check if port is in use on Linux or Unix - nixCraft
<code class="language-bash">sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo lsof -i:22 ## see a specific port such as 22 ##
sudo nmap -sTU -O IP-address-Here</code>
linux  bash  sysadmin  networking  solution 
october 2019 by kme
« earlier      
per page:    204080120160

Copy this bookmark:

to read