C Shell (csh)
History
The C Shell (csh) was developed by Bill Joy in the late 1970s at the University of California, Berkeley. It was designed to improve upon the Bourne Shell (sh) by providing a more user-friendly interface and incorporating features inspired by the C programming language, hence the name "C Shell."
Features
C-like Syntax: The syntax of csh is similar to the C programming language, making it easier for C programmers to use.
Job Control: Allows users to manage multiple processes within a single shell session.
History Mechanism: Enables users to recall and edit previous commands.
Aliases: Allows users to create shortcuts for frequently used commands.
Scripting: Supports writing scripts to automate tasks.
Basic Commands
Navigation
pwd
: Print the current working directory.cd [directory]
: Change the current directory to the specified directory.ls
: List the contents of the current directory.
File and Directory Management
touch [filename]
: Create a new empty file.mkdir [directory]
: Create a new directory.rm [filename]
: Remove a file.rmdir [directory]
: Remove an empty directory.cp [source] [destination]
: Copy a file or directory.mv [source] [destination]
: Move or rename a file or directory.
Scripting
Basic Script
Variables
Conditional Statements
Loops
For Loop
While Loop
Functions
File Operations
Creating a File
Reading a File
Deleting a File
Example: Backup Script
This script compresses the contents of the source directory into a tar.gz file and saves it in the backup directory with a timestamp.