The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,811 other followers

Archive for the ‘BSD’ Category

ducks: How Do I Find The Largest Top 10 Files and Directories On a Linux / UNIX / BSD?

Posted by jpluimers on 2017/03/20

Explains how to find out top 10 files and directories under Unix / Linux using sort and du command in human-readable format.

Interesting, especially

alias 'ducks=du -cks * | sort -rn | head'

Source: How Do I Find The Largest Top 10 Files and Directories On a Linux / UNIX / BSD?

via: Joe C. Hecht and nixCraft.

–jeroen

Posted in *nix, *nix-tools, Apple, BSD, Linux, Mac, OS X, Power User | Leave a Comment »

Determining the current shell in *n*x variants including ESXi

Posted by jpluimers on 2017/02/08

On most systems, I use bash as shell, but not all systems have it, for instance the shell.xs4all.nl server uses tcsh and ESXi 4+ uses a very limited ash shell from busybox (ESX 4 had bash though).

There is this huge script that covers many shell and operating system versions (even DOS, Windows) and interpreters (python, ruby, php, etc) what shell is this which I got through Stéphane Chazelas‘s answer in linux – determine shell in script during runtime – Unix & Linux Stack Exchange

I wanted a shorter thing that works in current Linux, BSD, OS X and ESXi versions.

Some very short scripts are less reliable, for instance echo $SHELL looks nice, but isn’t always set.

Similar for echo $0 which will fail for instance if it shows as sh but in fact is a different shell in disguise.

This works for bash, tcsh and busybox sh, is a bit more precise than getting $0. It’s based on HOWTO: Detect bash from shell script – Stack Overflow:

lsof -p $$ | awk '(NR==2) {print $1}'

But on ESXi it shows this because lsof doesn’t take any parameter there and just dumps all information:

----------+---------------------+---------------------+--------+------------------

It’s because lsof on ESXi always shows this header where Cartel and World aren’t exactly well documented:

Cartel | World name | Type | fd | Description
----------+---------------------+---------------------+--------+------------------

Empirically for non VM related processes, it looks like the Cartel is the PID and World name the command.

On Linux and BSD based systems, the header looks like this, so command and PID are reversed in ESXi:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

This command then works on both ESXi, OS X, Linux and BSD assuming you can word search for the PID and noting that PID/command will be reversed on ESXi as compared to OSX/Linux/BSD:

lsof -p $$ | grep -w $$ | awk '(NR==2) {print $1,$2}'

–jeroen

Posted in Apple, bash, BSD, Development, iMac, Mac, MacBook, MacBook Retina, MacBook-Air, MacBook-Pro, MacMini, OS X, OS X El Capitan, OS X Leopard, OS X Lion, OS X Maverick, OS X Mountain Lion, OS X Snow Leopard, OS X Tiger, OSX Yosemite, Power User, Scripting, Software Development | Leave a Comment »

Make A Bootable Windows 10 USB Install Stick On Linux With WinUSB Fork ~ Web Upd8: Ubuntu / Linux blog

Posted by jpluimers on 2016/07/29

One day I’m going to need this: Make A Bootable Windows 10 USB Install Stick On Linux With WinUSB Fork ~ Web Upd8: Ubuntu / Linux blog

So I’m glad WinUSB (which hadn’t been maintained for a long time) got forked on github by slaka.

Since my day-to-day unix-like system is OS X, I’d love a good working solution there too which means I probably need to investigate a bit along these lines:

–jeroen

via: Make A Bootable Windows 10 USB Install Stick On Linux With WinUSB Fork WebUpd8 – Google+  / DoorToDoorGeek “Stephen McLaughlin” – Google+

 

 

Posted in *nix, Apple, BIOS, Boot, BSD, Linux, OS X, OS X El Capitan, OS X Maverick, OSX Yosemite, Power User, Ubunto, UEFI, Windows, Windows 10, Windows 7, Windows 8, Windows 8.1, Windows 9, Windows Server 2000, Windows Server 2003, Windows Server 2003 R2, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Vista, Windows XP | Leave a Comment »

Woof – simply exchange files – one-time sharing of a file over http

Posted by jpluimers on 2016/06/22

Woof is a small simple stupid webserver that can easily be invoked on a single file. Your partner can access the file with tools he trusts (e.g. wget). No need to enter passwords on keyboards where you don’t know about keyboard sniffers, no need to start a huge lot of infrastructure, just do a

$ woof filenameand

tell the recipient the URL woof spits out. When he got that file, woof will quit and everything is done.And when someone wants to send you a file, woof has a switch to offer itself, so he can get woof and offer a file to you. …

Woof needs Python on a unix’ish operating system. Some people have used it successfully on Windows within the cygwin environment.

Source: Woof – simply exchange files

Works from homebrew on OS X.

via: Web Offer One File – Thomas Mueller (dummzeuch) – Google+

Source: Web Offer One File

–jeroen

Posted in *nix, *nix-tools, Apple, BSD, Home brew, Linux, Mac, OS X, Power User | Leave a Comment »

 
%d bloggers like this: