{"id":17673931,"url":"https://github.com/pratishtha-abrol/shell-c","last_synced_at":"2025-03-30T16:21:37.458Z","repository":{"id":118596197,"uuid":"294915863","full_name":"pratishtha-abrol/Shell-C","owner":"pratishtha-abrol","description":"A working shell based on the Linux Terminal, coded in C","archived":false,"fork":false,"pushed_at":"2020-10-02T04:14:30.000Z","size":281,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T17:59:30.625Z","etag":null,"topics":["c","linux-commands","linux-shell","pipeline","redirection"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pratishtha-abrol.png","metadata":{"files":{"readme":"README.md","changelog":"history.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-09-12T09:54:24.000Z","updated_at":"2021-03-11T15:44:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"2338a0cb-2b70-4f1b-a37b-fc16fe78aec2","html_url":"https://github.com/pratishtha-abrol/Shell-C","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratishtha-abrol%2FShell-C","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratishtha-abrol%2FShell-C/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratishtha-abrol%2FShell-C/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pratishtha-abrol%2FShell-C/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pratishtha-abrol","download_url":"https://codeload.github.com/pratishtha-abrol/Shell-C/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246343551,"owners_count":20762057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","linux-commands","linux-shell","pipeline","redirection"],"created_at":"2024-10-24T06:22:32.840Z","updated_at":"2025-03-30T16:21:37.437Z","avatar_url":"https://github.com/pratishtha-abrol.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linux Shell in C\n\n## Overview\n\nThis is an attempt to immitate the Linux terminal. It supports most semicolon separated commands, including builtin commands like cd, ls, echo, pwd.\nBackground and Foreground processes are also handled.\n\n* pwd : prints present working directory.\n\n* cd : changes directory as per the flags given.\n   ``` bash\n       cd\n       cd .\n       cd ..\n       cd ~\n       cd \u003cdirectory\u003e\n    ```\n\n* ls : lists contents of a particular directory based on the flags given. All flags are supported, ordering doesn't matter.\n  ```  bash\n       ls\n       ls -a\n       ls -l\n       ls -la\n       ls -al\n       ls \u003cdirectory\u003e\n    ```\n\n* echo : prints a message on the terminal.\n    ``` bash\n        echo \u003c\"Hello World\"\u003e\n    ```\n\n* pinfo : lists details of a given process id, of the shell in case process id is not specified.\n   ``` bash\n       pinfo \u003cpid\u003e\n       pinfo\n    ```\n    \n* setenv : setting an environment variable\n    ``` bash\n        setenv a 7\n    ```\n\n* unsetenv : unsetting an environment variable\n    ``` bash\n        unsetenv a\n    ```\n    \n* jobs : prints a list of all jobs executed by the shell\n    ``` bash\n        jobs\n    ```\n    \n* kjob : send specified signal to the specified job\n    ``` bash\n        kjob 2 9\n    ```\n    \n* fg : brings a background process to foreground\n    ``` bash\n        fg 1\n    ```\n\n* bg : pushes a foreground process to the background\n    ``` bash\n        bg 2\n    ```\n\n* overkill : kills all running processes in the shell\n    ``` bash\n        overkill\n    ```\n\n## Foreground and Background processes\n\n* Foreground processes require the shell to halt for the child process to complete before the shell resumes control.\n     ``` bash\n        vim\n        gedit\n        emacs\n    ```\n\n* Background processes are specifies with a '\u0026' at the end as a flag. These processes run in the background allowing the shell to execute processes simultaneously.\n    ``` bash\n        emacs \u0026\n        evince \u0026\n        gedit \u0026\n    ```\n\n## Supported Functions\n* The shell supports redirection using \u003c, \u003e, \u003e\u003e\n* The shell supports pipping\n* Input- Output redirection is supported.\n* CTRL + Z and CTRL + C are accepted\n\n## Running the shell\n\nIn order to run the shell on your local device use the following command :\n``` bash\nmake\n./a.out\n```\n\n## Pseudo Home\n\nThe shell considers the home directory to be the directory in which the executable ./a.out resides.\n\n## Exiting the shell\n\nTo exit the shell, use the following command :\n``` bash\nquit\n```\n\n## Code Files\n\n* main.c\nContains the main driver code for the shell.\n\n* execute.c\nContains the code to execute each command.\n\n* pwd.c\nContains the function to execute builtin pwd command.\n\n* ls.c\nContains the function to execute builtin ls command, and support all flags.\n\n* cd.c\nContains the function to execute builtin cd command.\n\n* echo.c\nContains the function to execute builtin echo command.\n\n* pinfo.c\nContains the function to execute builtin pinfo command.\n\n* history2.c\nContains the function to display history.\n\n* redirection.c\nContains the code for basic redirection.\n\n* pipeline.c\nContains the code for pipelined commands.\n\n* jobs.c\nContains the function to execute builtin jobs command.\n\n* kjob.c\nContains the function to execute builtin kjob command.\n\n* overkill.c\nContains the function to execute builtin overkill command.\n\n* setenv.c\nContains the function to execute builtin setenv command.\n\n* unsetenv.c\nContains the function to execute builtin unsetenv command.\n\n* fg.c\nContains the function to execute builtin fg command.\n\n* bg.c\nContains the function to execute builtin bg command.\n\n* nightswatch.c\nContains the function to execute builtin nightswatch command. Implementation in progress.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratishtha-abrol%2Fshell-c","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpratishtha-abrol%2Fshell-c","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpratishtha-abrol%2Fshell-c/lists"}