≡ Menu

unix shell

How To Find Files by Content Under UNIX

I had written lots of code in C for my school work and saved it as source code under /home/user/c/*.c and *.h. How do I find files by content such as string or words (function name such as main() under UNIX shell prompt?
[click to continue…]

What Are Linux / UNIX Shells?

Can you explain me UNIX shell? What are Shells?
[click to continue…]

Bash Shell Loop Over Set of Files

How do I run shell loop over set of files stored in a current directory or specified directory?
[click to continue…]

Q. How do I find out file last modification time using a shell script or command? How do I delete or take any other custom action for all files more than one hour old in /home/ftp/incoming/raw/ directory?
[click to continue…]

Printing output of c program to a file in Linux

Q. I’ve written a small program that does something useful for me. I always get output on screen. Sometime I need to send output to a file. How do I print output of my program to a file w/o making any changes to code?

A. Bash shell (and many other modern UNIX shell) supports the concept of I/O redirection It allows you to redirect standard output (screen), standard error and standard input (keyboard) using the following syntax.
command > output.file
command < input.file command >& error-n-output.file

So to redirect output of your own C program just enter:
$ ./myprogr > output.txt
$ cat output.txt

How do I read or display command-line arguments with Perl?
[click to continue…]