Linux Command Cheat Sheet
Everyday commands for web development — keyword search supported
lsList directory contentsls -laDetailed list including hidden filescd ~/projectsSwitch to the projects directorycd ..Go up one directorypwdPrint current pathmkdir myappCreate a new foldermkdir -p a/b/cCreate nested folders in one gorm file.txtDelete a filerm -rf myfolderForce delete a folder (use with care)cp src.txt dst.txtCopy a filemv old.txt new.txtMove or rename a filetouch index.htmlCreate an empty filefind . -name '*.js'Search for .js files under the current directorycat file.txtPrint the entire fileless file.txtPage through a file (q to quit)head -n 20 file.txtShow the first 20 linestail -f app.logFollow log output in real timegrep 'error' file.logSearch for a keyword in a filegrep -r 'TODO' ./srcRecursively search a directorywc -l file.txtCount linesdiff a.txt b.txtCompare two fileschmod +x script.shMake a file executablechmod 755 fileSet rwxr-xr-x permissionschown user:group fileChange file ownersudo commandRun as administratorls -lView permissions (rwxr-xr-x format)ps auxList all running processesps aux | grep nodeFilter for node processeskill 1234Terminate the process with PID 1234kill -9 1234Force kill a processtopLive view of system resource usagehtopInteractive system monitor (install required)&Append & to run a command in the backgroundjobsList background jobsCtrl+CAbort the running commandCtrl+ZSuspend the process (fg to resume)curl https://example.comSend a GET requestcurl -X POST -d '{}' urlSend a POST requestwget https://example.com/fileDownload a fileping google.comTest network connectivitynetstat -tulpnList open portsss -tulpnShow socket status (modern netstat replacement)ssh user@hostSSH into a remote hostscp file user@host:/pathCopy a file to a remote hostifconfigView network interfaces (legacy)ip addrView network interfaces (modern)apt updateRefresh the package listapt install nginxInstall a packageapt remove nginxRemove a packageapt upgradeUpgrade all packageswhich nodeShow install location of a commandnode -vShow Node.js versionnpm init -yInitialize a project (skip prompts)npm installInstall package.json dependenciesnpm install expressInstall the express packagenpm install -D viteInstall as a dev dependencynpm run devRun the dev scriptnpm run buildRun the build scriptnpx create-react-app myappScaffold a React project with npxgit initInitialize a Git repositorygit clone urlClone a remote repositorygit statusShow current statusgit add .Stage all changesgit commit -m 'msg'Commit changesgit push origin mainPush to remotegit pullPull latest changesgit branchList all branchesgit checkout -b feat/xCreate and switch to a new branchgit log --onelineCompact commit historygit stashStash current changesdf -hShow disk usagedu -sh ./Size of the current directoryfree -hShow memory usageuname -aShow system infouptimeShow uptime and loadhistoryShow command historyecho $PATHPrint the PATH variableenvList all environment variables