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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:41:15+00:00 2026-05-16T23:41:15+00:00

I face many times this simple and repetitive task configuring the LAMP or some

  • 0

I face many times this simple and repetitive task configuring the LAMP or some stuff in Ubuntu or Drupal:

I have to edit a config file (php.ini, httpd.conf, … whatever) so quite frequently, if I don’t remember the path by heart, I run these 2 commands:

locate php.ini
------- typing manually one of the paths that are shown in the list...
nano /etc/php5/apache2/php.ini

I’m sure this can be improved (without having to memorize the paths). Is there a better approach?

I like the way how this was solved with the command history: you can execute one of the previous commands in history with !32 (for example). Is there a similar way with locate or find commands?

  • 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-05-16T23:41:15+00:00Added an answer on May 16, 2026 at 11:41 pm

    This won’t work if files or directories have spaces in their names, but it wouldn’t be too hard to make a version that would.

    choose () {
        local PS3="Choose a file to edit: "
        select opt in $(locate "$1") quit
        do
            if [[ $opt = "quit" ]]
            then
                break
            fi
            ${EDITOR:-nano} "$opt"
        done
    }
    

    Demo:

    $ choose php.ini
     1) /etc/php5/apache2/php.ini
     2) /etc/php5/apache2/php.ini.ucf-old
     3) /etc/php5/apache2/php.ini~
     4) /etc/php5/cli/php.ini
     5) /etc/php5/cli/php.ini~
     6) /home/dennis/Downloads/php.ini
     7) /usr/share/doc/php5-common/examples/php.ini-dist
     8) /usr/share/doc/php5-common/examples/php.ini-paranoid
     9) /usr/share/doc/php5-common/examples/php.ini-recommended
    10) /usr/share/php5/php.ini-dist
    11) /usr/share/php5/php.ini-dist.cli
    12) quit
    Choose a file to edit: 12
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have exported many times tables from Hive to SQL Server. I never face
Many times while writing functions that accept enumerable types I face this confusion. Which
I have refereed old questions and found that people face many issues after installing
I face some layout differences in IE and in Chrome. I have searched Stack
I face a situation where we have many very long methods, 1000 lines or
I am facing this problem so many times, I used to send the apk
I thought I had my head around this... Had it working many times before.
I face some problems when I am trying to remove rows from a table
New to javascript, I face many problems. I read the javascript tutorial at w3cschools.com,
i have a list struct: typedef struct FaceNode{ FaceNode *next; Face *aFace; FaceNode *prev;

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.