{"id":1050,"date":"2015-02-02T06:28:40","date_gmt":"2015-02-02T06:28:40","guid":{"rendered":"https:\/\/intelligentbee.com\/blog\/?p=1050"},"modified":"2024-08-28T12:31:50","modified_gmt":"2024-08-28T12:31:50","slug":"linux-commands-every-web-developer-should-know","status":"publish","type":"post","link":"https:\/\/intelligentbee.com\/blog\/linux-commands-every-web-developer-should-know\/","title":{"rendered":"Linux Commands Every Web Developer Should Know"},"content":{"rendered":"<p>Here&#8217;s a list of Linux commands I found very useful throughout the years. You might want to\u00a0bookmark it as you&#8217;ll surely need it again someday.<\/p>\n<p><!--more--><\/p>\n<h2>Archive files of folders:<\/h2>\n<p><code>tar -czf new-tar-file-name.tar.gz file-or-folder-to-archive<\/code><br \/>\n<code>tar -czf new-tar-file-name.tar.gz file1 file2 folder1 folder2<\/code><\/p>\n<h3>Unarchive:<\/h3>\n<p><code>tar -xzf tar-file-name.tar.gz<\/code><\/p>\n<h3>List and sort files by size:<\/h3>\n<p><code>ls -lS<\/code><br \/>\n<code>ls -lSr<\/code><\/p>\n<h3>List folder sizes:<\/h3>\n<p><code>du -sh \/*<\/code><\/p>\n<h3>Show free disk space:<\/h3>\n<p><code>df -h<\/code><\/p>\n<h3>Count all the files and folders in a directory:<\/h3>\n<p><code>ls | wc -l<\/code><\/p>\n<h3>Rename a file or folder:<\/h3>\n<p><code>mv name new_name<\/code><\/p>\n<h3>Remove an entire folder, with all its content:<\/h3>\n<p><code>rm -rf dir_name<\/code><\/p>\n<h3>Create a symlink:<\/h3>\n<p><code>ln -s [TARGET DIRECTORY OR FILE] .\/[SHORTCUT]<\/code><br \/>\nE.g.:<br \/>\n<code>ln -s \/usr\/local\/apache\/logs .\/logs<\/code><\/p>\n<h3>Convert windows stye line-endings to unix style for an entire project:<\/h3>\n<p>This command will skip the .git and .svn directories but you can adapt it to your needs:<br \/>\n<code>find . -path .\/.git -prune -o -path .\/*.svn -prune -o -print -exec dos2unix {} ;<\/code><\/p>\n<h3>Find files containing text:<\/h3>\n<p><code>grep -rnw 'directory' -e \"pattern\"<\/code><br \/>\nand here&#8217;s an example:<br \/>\n<code>grep -rnw \/etc\/apache2\/sites-available\/ -e \"www\"<\/code><\/p>\n<h3>Find (then delete) .svn folders form your project:<\/h3>\n<p><code>find . -name .svn -exec echo {} ;<\/code><br \/>\n<code>find . -name .svn -exec rm -rf {} ;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here&#8217;s a list of Linux commands I found very useful throughout the years. You might want to\u00a0bookmark it as you&#8217;ll [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[110,120,163,259],"yst_prominent_words":[426,594,1396],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/1050"}],"collection":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/comments?post=1050"}],"version-history":[{"count":3,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/1050\/revisions"}],"predecessor-version":[{"id":133209,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/posts\/1050\/revisions\/133209"}],"wp:attachment":[{"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/media?parent=1050"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/categories?post=1050"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/tags?post=1050"},{"taxonomy":"yst_prominent_words","embeddable":true,"href":"https:\/\/intelligentbee.com\/blog\/wp-json\/wp\/v2\/yst_prominent_words?post=1050"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}