user1525831
user1525831

Reputation: 13

Automating some commands in shell

Say i need to run a couple of commands automatically in a shell everytime i open the shell. how can i automate that?

For Example:

I need to automate the following:

  1. open a shell
  2. cd /specific folder
  3. find . -name 'app_logs'

Upvotes: 0

Views: 97

Answers (2)

Andrew
Andrew

Reputation: 1027

If it's BASH then you can put these commands into ~/.bashrc

Upvotes: 1

William Niu
William Niu

Reputation: 15853

It depends what OS and Terminal you're using. I imagine most of the popular terminal allows you to customise the startup command. For example, in the Terminal.app that comes with Mac OS X, you can go to Preferences > Settings > Shell > Startup / run command to specify a script to run on startup of each terminal window/tab.

Or you can simply at the commands at $HOME/.profile or $HOME/.bashrc, depending on your OS and shell.

Upvotes: 1

Related Questions