I was trying to delete ~/tmp folder and accidentally deleted the /tmp folder. Then when I tried to ls a folder structure I kept getting this error:
bash: cannot create temp file for here-document: Permission denied
To fix the error I ran the following commands:
1 2 3 4 5 6 7 | cd / mkdir tmp sudo chown root:root /tmp sudo chmod 1777 /tmp |