How to resolve “sh: 0: getcwd() failed: No such file or directory”

Today I was working with git and for that I had created a “workspace” directory which contained some source files. During this activity I opened another terminal and deleted the workspace directory from second terminal, where as the first terminal, I forgot that, I was still inside that deleted “workspace” directory.

When I tried to install git from that deleted directory, I got an error like,

$ sudo apt-get install git

sh: 0: getcwd() failed: No such file or directory

Solution :

This error was occurred because as I mentioned above, I had deleted the current working directory from where I tried to install git from second tab without realised I was working in that deleted directory.

hence the solution to the error “sh: 0: getcwd() failed: No such file or directory” is to come outside that directory or change to some other known directory and tried your command.

 cd .. 
Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense Multimedia - Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question