krishnan-r / a-linux-shell

A prototype linux shell.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Linux Shell - Operating Systems Lab Assignment

t

Features

  • Uses GNU Readline for interactive input and history navigation.
  • History Management
    • History is persisted to disk in ~/.oslab_history
    • History expansions and shell builtins.
  • Job Management:
    • Running multiple jobs in background.
    • Killing Jobs based on job numbers
  • Common shell builtins found in bash.
  • Redirecting standard streams to files.

Building from source

gcc main.c -lreadline -Wall -o shell

Documentation

Shell Builtins

  • exit - quit shell
exit
  • cd - Change directory
cd [directory]
  • jobs - List active jobs
jobs
  • kill - Kill active Job/Process
kill %[jobid]
kill [pid]
  • pwd - Display current directory
pwd
  • type - Check type of command - builtin/executable
type [command]
  • echo
echo Hello World
  • history - List history
history
!!  # run previous command  
!n  # run nth command in history.  
!-n # run nth command from end in history.
  • debug - Toggle debug output.
debug

Stream Redirection

Redirect stdin/stdout using > and < operators.

command < infiletxt > outfile.txt

About

A prototype linux shell.


Languages

Language:C 100.0%