Storing linux commands

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
PeterTi
Level 1
Level 1
Posts: 19
Joined: Wed Apr 17, 2013 1:27 pm

Storing linux commands

Post by PeterTi »

Hi people,

I'm quite new to Linux and fortunately enjoying working with it a lot.
The good thing is that i also enjoy working with the terminal.

I've done quite some tasks with the terminal. But some of them i just keep forgetting and i have to google everytime to find a command. For example starting and stopping a server and switching off my mousepad when i'm coding.

My question is:
Is there a nice terminal kind of way to remember my commands with and store them alphabetically or chronologically?
With other words automatically making a personal file where i can find al my used commands in without googling al the time.

This will speed up my command learning proces 8-)

Thanks a lot.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
cecar

Re: Storing linux commands

Post by cecar »

Maybe not exactly what you want but the terminal stores used commands. Cycle through them with arrow up, arrow down.
semicolon

Re: Storing linux commands

Post by semicolon »

Hi PeterTi,

Good to hear you like the command line! :D The commands you use in the terminal are automatically saved in the history, I believe it keeps the last 2000 commands you ran in the terminal.

There are several ways to use the history:
  • 1. Use the 'up key' to go one command back in the command line history.
  • 2. Use the command

    Code: Select all

    history
    to show the entire command line history. This is often combined with a search, for example:

    Code: Select all

    history | grep 'config'
    will show you all commands from the history in which the string 'config' occurs.
  • 3. Use the 'bang'-syntax (that's what commands starting with an exclamation mark are called). For example:

    Code: Select all

    !!
    will run the last command again. But probably more useful is:

    Code: Select all

    !foo
    which will run the most recent command which started with 'foo'.
I hope that's enough to let you enjoy the command line even more :)

Also see:

Code: Select all

man history
Last edited by semicolon on Thu Apr 18, 2013 9:24 am, edited 1 time in total.
GeneC

Re: Storing linux commands

Post by GeneC »

This may be of interest..

http://www.webupd8.org/2010/09/cli-comp ... o-use.html
CLI Companion is a tool aimed at making the terminal easier to use: it's a GUI that displays a list of commands and an embedded terminal under it. The application comes with a list of commonly used commands by default, each having a short description and if you want to find out more about a certain command, simply right click it and select "Help". This will display the "man" (manual) for the selected command.


You can of course add your own commands to CLI Companion: simply click the "Add" button, then enter your command, an argument (optional) and a description.

To run a command, you just have to select it and click "Apply" and you'll see the output in the embedded terminal. If the command requires an argument, it will prompt you - all using a GUI. You can also run multiple commands in the same time: click the "+" sign on the right and a new tab will open.

Advanced users may also find Cli Companion useful by storing custom commands they came across for easier access and since CliCompanion has a built-in search tool, those commands will be easy to find and run.
Image
Last edited by GeneC on Thu Apr 18, 2013 9:27 am, edited 1 time in total.
PeterTi
Level 1
Level 1
Posts: 19
Joined: Wed Apr 17, 2013 1:27 pm

Re: Storing linux commands

Post by PeterTi »

Just found it:

Code: Select all

gedit ~/.bash_history
And i will try cli companion. Thanks!
homerscousin

Re: Storing linux commands

Post by homerscousin »

Thank-you GeneC. I have been wanting to compile a list of commands for some time. This looks like it will keep a database of all my commands with my notes plus a terminal to run them in. Seems easier than searching the net or opening a seperate text file I created.
Locked

Return to “Beginner Questions”