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 7925711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:25:17+00:00 2026-06-03T18:25:17+00:00

How can I use the nice command with an alias? As an example: alias

  • 0

How can I use the “nice” command with an alias?

As an example:

alias list=ls
list # works
nice -10 list # doesn't work

How could I make that last line work?

  • 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-03T18:25:21+00:00Added an answer on June 3, 2026 at 6:25 pm

    Alias is a shell feature, and nice is an external program:

    $ type nice
    nice is hashed (/usr/bin/nice)
    

    It’s the program nice that runs the command passed as an argument, calling the C function execve, so all the arguments for it need to be evaluated BEFORE the call.

    So, it would probably better not to use an alias and simply put the whole command needed there, but if you really want to, you could try something like this:

    $ nice -10 `alias list | sed "s/^\(alias \)\?[^=]\+='//; s/'$//;"`
    

    alias list prints the alias definition in the format alias list='ls' (or list='ls', if it’s /bin/sh), so I did some sed substitutions there to get only the command it expands to.

    If you’re sure to use only bash you can use ${BASH_ALIASES[list]} instead, as pointed out in the comments:

    $ nice -10 ${BASH_ALIASES[list]}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

IntelliJ has this nice integrated shelve command that can kind of do this more
I'm trying to use C# to control a command line application background, which can
I've got a command line version of an Eclipse RCP GUI application that can
I figure I can either use one mail() command with a large Bcc list
I can use ipcs(1) to list out the active shared memory objects on a
Can someone show a quick example on how to use NSTask and NSPipe in
OK, the title is a bit(lot) cryptic, but that's the best one-line-summary I could
When I run vim from the command line in iTerm, syntax highlighting doesn't seem
I want to run coverage from the command line, but can't seem to get
I'm looking for a FTP client that I can use to upload new files

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.