Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8230421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:07:47+00:00 2026-06-07T17:07:47+00:00

I normally use ps -elf | grep proceesname to get a detailed description of

  • 0

I normally use ps -elf | grep proceesname to get a detailed description of the process named processname. I think that I have to write too much for this.

Now what i was thinking is to create a bash alias like

alias lsps='ps -elf | grep $1'

which will give the above detailed description only by using lsps processname.

So, my question is how do I create a bash alias which accepts an argument.

PS: I know I can write a shell script for the above task but I was just wondering how to do it with bash alias.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:07:49+00:00Added an answer on June 7, 2026 at 5:07 pm

    Very simple;

    alias lsps='ps -elf | grep'
    

    Command line arguments will be added automatically to the end of the alias:

    lsps arg1 arg2 arg3 => converted to => ps -elf | grep arg1 arg2 arg3
    

    That works only when you want to add arguments to the end of alias.

    If you want to get arguments of the alias inside of the expanded command line you must use functions:

    For example:

    lsps()
    {
        ps -elf | grep "$1" | grep -v grep
    }
    

    Functions as well as aliases can be saved in your ~/.bashrc file )or a file that is included from it):

    $ cat /tmp/.bash_aliases
    lsps()
    {
        ps -elf | grep "$1" | grep -v grep
    }
    
    $ . /tmp/.bash_aliases
    $
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code that where I would normally use one line: if (tableView
I normally use a dirty method to get my Facebook Graph API token key
I have identified the query constructs my users normally use. Would it make sense
I normally use Firefox and have had no problems with the admin page on
My understanding is that Google Analytics (the tool I'd normally use for website analytics)
I normally use a GET variable i n the URL to determined what data
Anything I do in views that would normally use ajax to open up a
I have an issue usign QTableWidgetItem. I normally use the QTableWidget like this this->setItem(i,
I am a total newbie with Python, I normally use Perl. I have an
I normally use scp to copy stuff, but now I'm trying to get used

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.