{"id":19446568,"url":"https://github.com/imsatyasaiteja/simple-linux-shell","last_synced_at":"2026-05-12T12:02:52.337Z","repository":{"id":64910917,"uuid":"579365361","full_name":"imsatyasaiteja/Simple-Linux-Shell","owner":"imsatyasaiteja","description":"This CLI application, written in C, mimics the actual Linux shell by leveraging system functions and performs key Linux operations. Namely: cd, echo, pwd, mkdir, ls, cat, rm, and date","archived":false,"fork":false,"pushed_at":"2024-03-10T06:30:17.000Z","size":574,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-25T08:42:08.476Z","etag":null,"topics":["c-programming","execvp","getcwd","linux-commands","linux-shell"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imsatyasaiteja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-12-17T13:01:57.000Z","updated_at":"2024-12-19T12:59:56.000Z","dependencies_parsed_at":"2024-03-10T07:30:11.983Z","dependency_job_id":null,"html_url":"https://github.com/imsatyasaiteja/Simple-Linux-Shell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/imsatyasaiteja/Simple-Linux-Shell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsatyasaiteja%2FSimple-Linux-Shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsatyasaiteja%2FSimple-Linux-Shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsatyasaiteja%2FSimple-Linux-Shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsatyasaiteja%2FSimple-Linux-Shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imsatyasaiteja","download_url":"https://codeload.github.com/imsatyasaiteja/Simple-Linux-Shell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imsatyasaiteja%2FSimple-Linux-Shell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32938003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T09:19:52.626Z","status":"ssl_error","status_checked_at":"2026-05-12T09:17:33.438Z","response_time":102,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-programming","execvp","getcwd","linux-commands","linux-shell"],"created_at":"2024-11-10T16:14:25.474Z","updated_at":"2026-05-12T12:02:52.302Z","avatar_url":"https://github.com/imsatyasaiteja.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Simple Linux Shell\n\nHey! Here's a Command Line Interface application I've written in C language that works like a Linux shell\n\n### Preview\nHere are some important Linux commands that I've tested on my Linux shell application\n\n\u003cimg src=\"https://github.com/imsatyasaiteja/Simple-Linux-Shell/assets/85508314/8098031e-be1a-43c3-9c99-f32f6dfb04be\" width=\"400\" alt=\"commands_1\"\u003e\n\u003cimg src=\"https://github.com/imsatyasaiteja/Simple-Linux-Shell/assets/85508314/daac292d-25e7-4e2f-be2b-538baca8a945\" width=\"400\" alt=\"commands_2\"\u003e\n\n### Code Explanation\n- The _main( )_ function executes a _while_ loop\nWe need this loop to run the shell input command infinitely after execution of each command\n- The _shell_ function does the following job :\n  - It stores the user input in the character array _cmd[100]_ (string)\n  - length of this string _cmd_ is stored in _l_\n- We pass this string cmd and its length _l_ to a token function _tok(cmd,l)_\n- The _tok(cmd, l)_ function's return type is a 2D array (an array of strings)\n  - This function takes the _cmd_ string and tokenizes it into a group of strings\n  - A global variable _g_ is used to store the number of tokens obtained\n- The array of strings returned by token function is stored in _a_\n- Now, we compare the first token _a[0]_ given by the user with _cd, echo, pwd_, If the token matches with any one of them, its respective function is called :\n  - _Cd(a)_ function uses _chdir(a[1])_, an in-built function to change the directory\n  - _Echo(a)_ function concats all the tokens from _a[1]_ to _a[g-1]_ and stores in a string _b_\n  - A _for_ loop is used to remove _\"_ character\n  - _Pwd( )_ function uses _getcwd( )_, an in-built function to get the current working directory\n  - _Cmd(a)_ function is used to access commands like _mkdir, ls, cat, rm, date_ executables in the bin folder using **_execvp( )_**\n\t- In this _Cmd(a)_ function, **_fork( )_** function is used to initialize a child process\n\t- In the child process execvp is used. Its return value is stored in a variable z\n\t- If _z != 0_, It displays an error\n\t- _execvp_ takes the input command and the array of strings as arguments\n\t- _execvp_ function calls the file from bin folder according to the user input\n\t- Meanwhile, the parent process waits for the child process to exit             \n- After leaving the _if-else_ loop and executing one of the _Cd( ), Pwd( ), Echo( ), Cmd( )_ functions, the array a memory is freed\n- Because we have a _while_ loop in our Main function and it breaks only when character _ch != '\\n'_\n- At each step, it calls the shell function again\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsatyasaiteja%2Fsimple-linux-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimsatyasaiteja%2Fsimple-linux-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimsatyasaiteja%2Fsimple-linux-shell/lists"}