44 comments

[ 3.2 ms ] story [ 103 ms ] thread
Yeah this is OK, but running macOS commands for Linux deployments doesn't work all the time. What about `lsblk` or `ip`? Also md5 vs md5sum. Also and I don't have macOS handy to try it, I'm pretty sure grep has differing options. I can't count how many times friends and colleagues who use macOS for development have put BSD commands into Dockerfiles and CI pipelines and have wondered why it didn't work.
This was a massive problem for me as well. And they laughed at me using a virtual machine with Linux in it while they were pissing around with broken stuff...
When I was given a macbook at work I used to curse all the time at mac os' grep which is not gnu grep, and lacks a lot of nice cool features...
You can use brew to install gnu grep as a replacement.
Its funny how people will admit to being upset about something when they are supposed to be tech saavy and should have just googled the solution .
on my work MacBook we can't just brew install things, no admin permissions except for whitelisted things
Lucky that you can install homebrew into your home directory with no admin rights then!
Thank god somebody understands that not everybody is given toy macbooks to install whatever they like with no screening and/or block list.
(comment deleted)
You can install brew to any directory, including your home directory.
Your criticism is valid, but its possible to get compatibility between macOS (or another BSD) and Linux. GNU utilities are already mentioned but there's also, for example,

> What about `lsblk` or `ip`?

For a (partly compatible) equivalent to ip I can recommend iproute2mac [1]. You can also use the old utilities from BSD (ifconfig, route, etc) or the GUI.

For lsblk I found no drop-in replacement, just equivalents [2]

On top of that, Nix works on Linux and macOS.

[1] https://github.com/brona/iproute2mac

[2] https://apple.stackexchange.com/questions/107953/list-all-de...

[3] https://nixos.org

pushd and popd. Thank me later.
Weird, my Ubuntu 20 install does not have man pages on pushd and popd. Are these commands be specific to bash?

Anyway, since we are on the topic of directory navigation, I'd like to introduce 'cd -' (toggle to previous dir). Thank me later :-)

They are bash built-ins. They are documented in bash's man page.
can also use `help pushd` to get manual only for that command ('help' is like 'man' for built-ins)
This is what I needed. None of the man pages showed information on the bash functions. 'help' did the job.

Ironically, 'man help' yields no results.

That's because `help` is also builtin. It's listed under "SHELL BUILTIN COMMANDS" in `man bash 1` (or use the non-obvious `help help`)
They are shell-specific, yes. Fish also has it built-in.

Try man -a {pushd,popd} you can also use the man -k flag to find manpages, and see man man (or man --help) for more flags.

zsh also has them.

Another neat way of wrapping code in pushd/popd is to use a subshell.

    (cd $dir
       do-stuff
    )
Oilshell ( https://www.oilshell.org/ ) has support for code blocks so you can:

    cd /tmp {
      do-stuff
    }
Get docs for shell builtins with help. Eg: `help pushd`
Also 'setopt autopushd' (and other related options) for zsh
What is the 'open' command? Is it alias for the 'xdg-open'?

Edit: Just noticed they are using MacOS. That makes it clear.

This is really handy. Is there a similar document on the UNIX ideology/file structure?
Something I learned the other day is that on Linux you can type `man hier` in a terminal to get a description of the filesystem hierarchy
Several red flags here.

First, I have to fill in a form and confirm an e-mail subscription before I can download the PDF. For reference, the real download link is https://flaviocopes.nyc3.digitaloceanspaces.com/linux-comman...

Secondly, "No one can dictate which apps you can run, or “call home” with apps that track you, your position, and more."

Everything from ubuntu's amazon lens integration to android to firefox' pocket integration comes to mind. Yes, technically you can rebuild all these things from source and strip out the parts you don't like - don't like google tracking you? Chromium is open source, just edit the tracking out and build your own!

Practically speaking just about no-one can manage that. You have to either live with what you're offered or go to a lot of effort and practically have a degree in CS or equivalent. The author here has a very simplistic view of the world.

This sounds like a moderate-at-best quality article written to farm newsletter subscriptions. Could be better.

> Linux is an operating system, like macOS or Windows.

Nup, it's just a kernel.

I'd just like to interject for moment. What you're refering to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.

Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called Linux, and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.

There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called Linux distributions are really distributions of GNU/Linux!

(https://www.lurkmore.com/view/GNU/Linux_interjection)

> All the so-called Linux distributions are really distributions of GNU/Linux!

s/All/Most

Alpine Linux uses musl libc and busybox, for example.

Thank you for the excellent explanation! I have always referred to Linux as an operating system and I will be more careful with that nuance. I was one of today's 10,000 [0].

[0] https://xkcd.com/1053/ (Ten Thousand)

You're being trolled. The comment you replied to is a copy paste of an oft-mocked post made by Richard Stallman. People post it in Linux threads to make fun of his pedantry and his perceived bitterness over Linux becoming the dominant kernel over GNU Hurd
Apologies for the late response, but thank you for letting me know!
This just isn’t really true from a linguistic point of view any more.

Most people use Linux to mean one of many full operating system distributions, and then refer to the kernel as ‘the Linux kernel’. Gnu gets referred to in relation to the many tools. That’s just how the language has worked out.

The comment is certainly true in terms of who contributed various components, although many distributions do increasingly contain critical components that have nothing to do with GNU.

You're being trolled. The comment you replied to is a copy paste of an oft-mocked post made by Richard Stallman. People post it in Linux threads to make fun of his pedantry and his perceived bitterness over Linux becoming the dominant kernel over GNU Hurd.
Troll successful!

I knew it was Stallman’s bitterness. I just didn’t know it was a copy/paste!

It's not that hard in Arch Linux. You get the PKGBUILD for original package, and run makepkg once with an option to just prepare the src/, then you can modify it and then you run makepkg with a flag to skip the src/ preparation and finish the build.

Just to change the build/configure flags, you can simply edit the PKGBUILD.

Nothing fancy, I've been building firefox this way to disable signing requirements for extensions, until I gave up on firefox extensions completely, because of the general unfriendliness to developers with the signing requirements that can't be disabled without wasting a shitton of electricity.

icecat has all the tracking stuff from Firefox removed. If you're willing to put up with the "purists" from eg the FSF you get a lot of benefits like not having your software track you or do things you don't like because the dark pattern works with some sales funnel etc.
Um, so someone just copied in content from manpages?
Having read a few of the commands, I suddenly wish many of the man pages and help (not all) of common GNU/Linux commands could be re-written in the plainest and simplest of language, like this, or re-ordered with a simplistic explanation at the beginning and more detailed further down the file. Most commands on GNU/Linux require no background knowledge, or knowledge of the more powerful applications of the command and their man pages tend to just get in your way, even though they are clear and precise; by necessity they are difficult to read (since their goal is usually completeness, rather than accessibility).
Surprising exclusion: the mount command