kali-all-commands

after install Kali linux in WSL in Windows:

If the /mnt/c directory is not accessible, it may indicate one of the following issues:

  1. Windows Drives Are Not Mounted:
    • By default, WSL should automatically mount your Windows drives under /mnt. However, this may not happen if the feature is disabled or there’s a configuration issue.
  2. Check Mount Points:
    • First, verify what is mounted under /mnt:
      ls /mnt
      
    • If you don’t see directories like c or d, the drives may not be mounted.
  3. Ensure Automount is Enabled:
    • Check the WSL configuration file (/etc/wsl.conf) to ensure that automounting of drives is enabled. Use the following command:
      cat /etc/wsl.conf
      
    • If the file doesn’t exist or doesn’t contain [automount], create or modify it:
      sudo nano /etc/wsl.conf
      

      Add the following lines:

      [automount]
      enabled = true
      root = /mnt
      
    • Save the file and restart WSL:
      wsl --shutdown
      

      Then relaunch Kali Linux.

  4. Manually Mount the Drives:
    • If automount still doesn’t work, you can manually mount the Windows drives. Run the following command:
      sudo mount -t drvfs C: /mnt/c
      
    • Then, try accessing your desktop directory again:
      cd /mnt/c/Users/akashdip2001/Desktop
      
  5. Verify Windows Username:
    • Double-check your Windows username by looking at the C:\Users directory in Windows File Explorer to ensure the correct path.
  6. Restart WSL:
    • If the issue persists, restarting WSL can resolve temporary issues:
      wsl --shutdown
      wsl
      

It looks like the c drive is properly mounted under /mnt, which means you should be able to access it. The next step is to check the exact path to your desktop directory.

Let’s try to navigate to your desktop folder again, but this time double-check the directory structure:

  1. Go to the Users Directory: First, navigate to /mnt/c/Users to see if the folder exists:
    cd /mnt/c/Users
    ls
    
  2. Look for Your Username: In the output, you should see a folder corresponding to your Windows username (e.g., akashdip2001 or something similar). Once you find it, proceed with navigating to your Desktop folder:
    cd /mnt/c/Users/akashdip/Desktop
    

If the path to your desktop folder is different (for example, if the username is slightly different), make sure to replace akashdip2001 with the correct name.