AIX IBM shell commands?

I am doing some research into AIX IBM security, and how to check certain settings. Most of the checks involve you executing commands such as "# ls", "# acl get", "# grep" etc. etc. I assume you run these commands in some equivalent to the windows command shell?
Does it have an option to write the findings out to a text file, as you can in command prompt i..e >filename.txt

And also is there anyway to execute these commands in bulk, i.e. if you had 200 commands,  is there a way to package them alltogether, run the packaged bulk of commands, and have each command write the outout out to a text file, so at the end of the scan all you have got is say 200 text files in the same folder?
Who is Participating?
You can create a file in your current directory and put all your commands in it, named let's say mycmds, one per line.

You can then simply run this file with

sh mycmds

Output redirection works exactly the same way as in the command prompt. In fact, the command above starts a subshell of your login shell so the behavior of both is the same.

Thus you can append "> unique_logfile_name" to each command in mycmds.

Automating the logfile stuff is also possible, but would involve writing one more shell script, perhaps like this:

while read cmd
     eval "$cmd" > ${cmd%%" "*}.$n.out
  done < mycmds

Put the above in a new file in your current directory named e.g. runcmds
then issue "chmod+x runcmds" and run it like this:


${cmd%%" "*}.$n.out constructs an output file name consisting of the first word of the command, a dot, a serial number for uniqueness, and the appendix ".out"

I used "eval" to run the single commands in case you have special things like pipes etc. in them.
pma111Author Commented:
Thanks. Do you have to put any form of file extension of the mycmds file, so that the sh command can execute it?
No, you don't. Unix/Linux shells don't rely on filename extensions.

Name your scripts as you like (to make your life easier choose meaningful names).

You can of course add ".sh" or something similar nonetheless to identify the file as a script at first sight.
pma111Author Commented:
wow, thought it would be loads more complex than that. Seems quite painless.
Yep, it's Unix!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.