Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14

Thread: Your favourite little helper bash scripts

  1. #11
    Join Date
    May 2007
    Location
    michigan
    Beans
    Hidden!
    Distro
    Kubuntu 11.04 Natty Narwhal

    Re: Your favourite little helper bash scripts

    Not a script but an alias - it helps since you can't dump top to a text file. First section is sorted by memory use, second section by CPU use.

    Code:
    alias processes="ps -eo pid,rtprio,ni,pri,pcpu,rss,comm --sort -rss && ps -eo pid,rtprio,ni,pri,pcpu,rss,comm --sort -pcpu"
    we don't see things as they are, we see them as we are.
    -- anais nin

  2. #12
    Join Date
    Sep 2006
    Beans
    8,627
    Distro
    Ubuntu 14.04 Trusty Tahr

    pkill

    Quote Originally Posted by matt_symes View Post
    It allows to do things like

    Code:
    kill -9 $(pgrep -x vi)
    Which can be done with pkill

    Code:
    pkill -9 -x vi

  3. #13
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: pkill

    Hi

    Quote Originally Posted by Lars Noodén View Post
    Which can be done with pkill

    Code:
    pkill -9 -x vi
    Of course there are many ways in Linux to get the same job done
    Exactly.

    Kind regards
    Last edited by matt_symes; May 3rd, 2011 at 12:21 PM.
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  4. #14
    Join Date
    Mar 2010
    Location
    Lake Constance
    Beans
    155
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: Your favourite little helper bash scripts

    Ok, I have to admit that I'm a real beginner when it's up to bash scripts (wow, amauk!), but I'll give it another shot and post something here. Maybe this time there isn't a built-in command that does the same only better .

    Code:
    #!/bin/bash
    # apt-get-proxy: Executes apt-get with proxy settings (e.g. for use with apt-cache-ng). Use 0 for proxy to don't use a no proxy.
    if [ "$1" = "0" ]
    then
      apt-get $2 $3 $4 $5 $6 $7 $8 $9
    else
      apt-get -o Acquire::http::Proxy="http://$1" $2 $3 $4 $5 $6 $7 $8 $9
    fi
    Usage: sudo apt-get-proxy <proxy-address-and-port> <normal apt-get arguments>

    I use apt-cacher-ng with my netbook as the server (I take that one to the university all the time) because at home my bandwith is limited. apt-get is configured to use the netbook as a apt-cacher-ng-proxy, so I use this script if the netbook isn't running. I was always wondering whether there is something like an expression for "I want $*, only without $1" for scripting this.

    I think I'll pimp up this script with amauk's root-require script.
    If SUDO is all-powerful, can SUDO start a process that SUDO can't kill?

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •