fedii.me
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
zarkanian@sh.itjust.works to Linux@lemmy.ml · 3 days ago

An amazing directory: /proc

lemmy.ml

message-square
69
link
fedilink
1

An amazing directory: /proc

lemmy.ml

zarkanian@sh.itjust.works to Linux@lemmy.ml · 3 days ago
message-square
69
link
fedilink
alert-triangle
You must log in or register to comment.
  • muusemuuse@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    0
    ·
    16 hours ago

    I never really considered using proc to solve my problems. I jump to logs and such but honestly, how have I never played with proc?

  • TerraRoot@sh.itjust.works
    link
    fedilink
    arrow-up
    0
    ·
    17 hours ago

    The hand written effect make these so much easier to digest.

  • utopiah@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    I have some of her paper zines on my desk, warmly recommended.

    Might look esoteric at first but if you think we will be using Linux at least on desktop, servers, consoles and more for decades then totally worth learning about.

  • rumba@lemmy.zip
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    You used to be able to sudo cat /proc/kcore > /dev/dsp and listen to your ram

    • muusemuuse@sh.itjust.works
      link
      fedilink
      English
      arrow-up
      0
      ·
      16 hours ago

      Wouldn’t that just sound like gibberish? I feel like Mike Lindell would come out of the speakers.

    • MonkeMischief@lemmy.today
      link
      fedilink
      arrow-up
      0
      ·
      18 hours ago

      That sounds really interesting! I couldn’t find anything else on this. Is this like pre-systemd?

    • KyuubiNoKitsune@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      0
      ·
      2 days ago

      The RAM whisperer.

  • communism@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    Julia Evans has a bunch of these really handy cheatsheets. I have several saved that I reference semi-regularly.

  • jabjoe@feddit.uk
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    Got to love UNIX’s everything is a file.

    ProcFS is from Plan9. https://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs#/proc

    Plan9 is worth a deep dive, but maybe not worth running. It is more UNIX than UNIX. (Also where UTF8 came from.)

    • friend_of_satan@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 days ago

      I did not know that about plan9! /proc was one of the things I missed most when I switched from daily driving linux to daily driving osx.

      • jabjoe@feddit.uk
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 days ago

        Well that is retrograde of it.

        Another cool thing from Plan9:

        https://github.com/torvalds/linux/blob/master/Documentation/filesystems/9p.rst

  • Unreliable@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    /proc is quite useful when it comes to hiding root on Android.

  • PowerCrazy@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    I didn’t know any of this. Amazing. I usually just look at /proc/net/ for routes and bonding config etc.

  • four@lemmy.zip
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    I’m surprised it doesn’t mention that /proc/self automagically points to the directory of the current process. So if you’re writing a program, you can just look there for information about itself

  • FluidBeef@quokk.au
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    I love *nix’s commitment to the bit on the core abstractions.

  • jaybone@lemmy.zip
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    I seem to recall in an Operating Systems class we wrote a kernel module and communicated with it through the proc interface?

    • white_nrdy@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      2 days ago

      I may have been through “SysFS” as well? In /sys/class you can setup char dev IO with a kernel module (and more). Very helpful for userspace <-> kernel communication (like DMA drivers for userspace applications)

      • jaybone@lemmy.zip
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 days ago

        Hmm yeah maybe it was /sys, it’s been so long I can’t remember.

        I seem to recall echoing into a file to set some value which we then checked the value of in the kernel module code. It was just a hello world type of thing for a college class.

  • jaybone@lemmy.zip
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    I’m aware of /proc but usually use lsof to find open fd’s for a process.

    Is one better than the other?

    • ozymandias117@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 days ago

      lsof just reads from /proc and gives you formatted output

      https://github.com/lsof-org/lsof/blob/master/lib/dialects/linux/dproc.c#L297

  • naught101@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    Damn, I really could have made a lot of use of this over the last 20+ years… Thanks for sharing!

  • Jankatarch@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    I am saving this, both for the post AND for the comments.

  • provectus@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    2 days ago

    Did you know openBSD does not have this folder? I think the BSD’s do not use /proc. I do not know why though.

    • SlurpingPus@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 days ago

      That raises the question of how their ps, top, lsof and such work, since afaik in Linux they read from /proc.

      P.S. Looks like BSDs tug at the kernel via syscalls, namely sysctl and also the ‘kvm interface’ in the case of MacOS (not sure what ‘kvm’ thing is meant here). Seems vaguely reasonable, since procfs also queries the kernel for the info, so about the same resources would be used, perhaps even with the overhead of filesystem traversal and string-numbers conversion.

      • provectus@lemmy.ml
        link
        fedilink
        English
        arrow-up
        0
        ·
        2 days ago

        I might be mistaken, but I think kvm stands for kernel virtual machine. Having no /proc, and interacting with sysctl instead sounds more secure, IMO.

Linux@lemmy.ml

linux@lemmy.ml

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

  • [email protected]
  • [email protected]
  • [email protected]
  • [email protected]

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 108 users / day
  • 495 users / week
  • 572 users / month
  • 616 users / 6 months
  • 0 local subscribers
  • 67.2K subscribers
  • 147 Posts
  • 1.23K Comments
  • Modlog
  • mods:
  • nooter692@lemmy.ml
  • MarcellusDrum@lemmy.ml
  • Arthur Besse@lemmy.ml
  • Cyclohexane@lemmy.ml
  • BE: 0.19.20
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org