Showing posts with label shell-scripting. Show all posts
Showing posts with label shell-scripting. Show all posts

Wednesday, February 6, 2019

Exploring the /proc filesystem: an article by me in Linux Pro Magazine


- By Vasudev Ram - Online Python training / SQL training / Linux training

Hi, readers,

Somewhat recently, I wrote this article which was published in Linux Pro Magazine:

Exploring the /proc filesystem with Python and shell commands

As the title suggests, it is about getting information from the Linux /proc file system, which is a pseudo-file system that contains different kinds of information about running processes. The article shows some ways of getting a few kinds of information of interest about one or more specified processes from /proc, using both Python programs and Linux shell commands or scripts. It also shows a bit of shell quoting magic.

(The article has a few small errors that crept in, late in the publishing process, but any programmer with a bit of Python knowledge will be able to spot them and still understand the article.)

Check it out.

Enjoy.

- Vasudev


- Vasudev Ram - Online Python training and consulting

I conduct online courses on Python programming, Unix / Linux commands and shell scripting and SQL programming and database design, with course material and personal coaching sessions.

The course details and testimonials are here.

Contact me for details of course content, terms and schedule.

Try FreshBooks: Create and send professional looking invoices in less than 30 seconds.

Getting a new web site or blog, and want to help preserve the environment at the same time? Check out GreenGeeks.com web hosting.

Sell your digital products via DPD: Digital Publishing for Ebooks and Downloads.

Learning Linux? Hit the ground running with my vi quickstart tutorial. I wrote it at the request of two Windows system administrator friends who were given additional charge of some Unix systems. They later told me that it helped them to quickly start using vi to edit text files on Unix. Of course, vi/vim is one of the most ubiquitous text editors around, and works on most other common operating systems and on some uncommon ones too, so the knowledge of how to use it will carry over to those systems too.

Check out WP Engine, powerful WordPress hosting.

Creating online products for sale? Check out ConvertKit, email marketing for online creators.

Teachable: feature-packed course creation platform, with unlimited video, courses and students.

Posts about: Python * DLang * xtopdf

My ActiveState Code recipes

Follow me on:


Monday, November 4, 2013

ShellCheck.net, useful site for sh/bash scripters

By Vasudev Ram



Saw this via a tweet by Cameron Laird (@Phaseit):

ShellCheck.net is a web site where you can paste in your sh or bash script, and it will statically analyse and lint it.

Excerpt from the ShelllCheck.net site:

[ ShellCheck is a static analysis and linting tool for sh/bash scripts. It's mainly focused on handling typical beginner and intermediate level syntax errors and pitfalls where the shell just gives a cryptic error message or strange behavior, but it also reports on a few more advanced issues where corner cases can cause delayed failures. ]

Apparently the tool is written in Haskell.

I tried it with the default example shown, and it seems to work, since it gave 5 errors or warnings about the code.

I then tried it again with this simple shell script:
a=1
while $a -lt 5
do
    echo $a
    a=`expr $a + 1`
done

and it found a couple of issues with it: that the backquotes are deprecated, and that expr is antiquated.

- Vasudev Ram - Dancing Bison Enterprises

Contact me



DiscountMags.com



Monday, July 16, 2012

Updated my Bentley-Knuth problem post with a Unix shell script solution

By Vasudev Ram


I added a Unix shell script solution to my recent post on the Bentley-Knuth problem


- Vasudev Ram - Dancing Bison Enterprises

Wednesday, July 4, 2012

Generate all Linux command man pages in one shot


Just saw this today:

Linux man-pages: list of all pages, by section

Useful. It does not include most commands (i.e. binaries), though. It mainly covers system calls and C library functions. The site says that that is the case because most commands come with their own man pages.

If you want to create your own set of man pages for Linux commands or for Unix commands, you can easily do it with this short shell script:

export MAN_DIR=some_directory_name
for dir in $CMD_DIRS
do
    cd $dir
    for cmd in `ls`
    do
        man $cmd >$MAN_DIR/$cmd.m
    done
done

where CMD_DIRS has a list such as:

"/bin /usr/bin /etc /sbin /usr/sbin" in it.

That's typically one of the first things that I used to do when using a new Unix system :)

And then you can use:

vi *.m

to read them all  ...

Or use * instead of ls in backquotes.
Posted via mobile, sorry for any formatting issues.

- Vasudev Ram
www.dancingbison.com

Sunday, February 5, 2012

Good list of Linux command-line resources


http://linuxcommand.org/who_what_where_why.php

See some way down that page.

- Vasudev Ram
www.dancingbison.com