{"id":554,"date":"2011-09-16T15:04:40","date_gmt":"2011-09-17T01:04:40","guid":{"rendered":"http:\/\/mymonkeydo.com\/?p=554"},"modified":"2023-10-19T06:58:28","modified_gmt":"2023-10-19T16:58:28","slug":"useful-linux-commands","status":"publish","type":"post","link":"https:\/\/mymonkeydo.com\/useful-linux-commands\/","title":{"rendered":"Useful Linux Commands"},"content":{"rendered":"

I recently had to move a server and needed to set up another server. I’m a linux newbie so I needed to look up a lot of things. Below are some of the more common commands that I needed: (replace with your own command\/name).<\/p>\n

Create a short name or alias to run a command.<\/h2>\n
alias =''<\/pre>\n

Create a symbolic link to another directory\/file<\/h2>\n
ln -s<\/pre>\n

http:\/\/kb.iu.edu\/data\/abbe.html<\/p>\n

Transfer files from your computer to a server<\/h2>\n
scp  :<\/pre>\n

Transfer files from a server to another server.<\/h2>\n
scp : :<\/pre>\n

Change file owner w\/ recursion<\/h2>\n
chown -R :<\/pre>\n

Change file permissions for web w\/ recursion<\/h2>\n
chmod -R 644<\/pre>\n

Find a file<\/h2>\n
find \/ -name<\/pre>\n

http:\/\/content.hccfl.edu\/pollock\/unix\/findcmd.htm<\/p>\n

Add a user<\/h2>\n
sudo useradd -d \/home\/ -m<\/pre>\n
sudo passwd<\/pre>\n

Change a users’ primary group<\/h2>\n
usermod -g<\/pre>\n

Add a group<\/h2>\n
groupadd<\/pre>\n

Add a user to a group<\/h2>\n
usermod -G<\/pre>\n

Make everything in a dir owned by the dir group owner<\/h2>\n
sudo chmod g+s<\/pre>\n

Find largest 10 files in wp-content folder<\/h2>\n
find wp-content -type f -exec du -h {} + | sort -rh | head -n 10<\/pre>\n
\n\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[6],"tags":[9,43],"yoast_head":"\nUseful Linux Commands - My Monkey Do<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mymonkeydo.com\/useful-linux-commands\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Useful Linux Commands - My Monkey Do\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mymonkeydo.com\/useful-linux-commands\/\" \/>\n<meta property=\"og:site_name\" content=\"My Monkey Do\" \/>\n<meta property=\"article:published_time\" content=\"2011-09-17T01:04:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-19T16:58:28+00:00\" \/>\n<meta name=\"author\" content=\"Webhead\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Webhead\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mymonkeydo.com\/useful-linux-commands\/\",\"url\":\"https:\/\/mymonkeydo.com\/useful-linux-commands\/\",\"name\":\"Useful Linux Commands - My Monkey Do\",\"isPartOf\":{\"@id\":\"https:\/\/mymonkeydo.com\/#website\"},\"datePublished\":\"2011-09-17T01:04:40+00:00\",\"dateModified\":\"2023-10-19T16:58:28+00:00\",\"author\":{\"@id\":\"https:\/\/mymonkeydo.com\/#\/schema\/person\/b16fc650a8c182faaac896bab099b829\"},\"breadcrumb\":{\"@id\":\"https:\/\/mymonkeydo.com\/useful-linux-commands\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mymonkeydo.com\/useful-linux-commands\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mymonkeydo.com\/useful-linux-commands\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/mymonkeydo.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Useful Linux Commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mymonkeydo.com\/#website\",\"url\":\"https:\/\/mymonkeydo.com\/\",\"name\":\"My Monkey Do\",\"description\":\"A Log of Coding Solutions\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mymonkeydo.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/mymonkeydo.com\/#\/schema\/person\/b16fc650a8c182faaac896bab099b829\",\"name\":\"Webhead\",\"url\":\"https:\/\/mymonkeydo.com\/author\/corey\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Useful Linux Commands - My Monkey Do","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mymonkeydo.com\/useful-linux-commands\/","og_locale":"en_US","og_type":"article","og_title":"Useful Linux Commands - My Monkey Do","og_url":"https:\/\/mymonkeydo.com\/useful-linux-commands\/","og_site_name":"My Monkey Do","article_published_time":"2011-09-17T01:04:40+00:00","article_modified_time":"2023-10-19T16:58:28+00:00","author":"Webhead","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Webhead","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/mymonkeydo.com\/useful-linux-commands\/","url":"https:\/\/mymonkeydo.com\/useful-linux-commands\/","name":"Useful Linux Commands - My Monkey Do","isPartOf":{"@id":"https:\/\/mymonkeydo.com\/#website"},"datePublished":"2011-09-17T01:04:40+00:00","dateModified":"2023-10-19T16:58:28+00:00","author":{"@id":"https:\/\/mymonkeydo.com\/#\/schema\/person\/b16fc650a8c182faaac896bab099b829"},"breadcrumb":{"@id":"https:\/\/mymonkeydo.com\/useful-linux-commands\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mymonkeydo.com\/useful-linux-commands\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/mymonkeydo.com\/useful-linux-commands\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/mymonkeydo.com\/"},{"@type":"ListItem","position":2,"name":"Useful Linux Commands"}]},{"@type":"WebSite","@id":"https:\/\/mymonkeydo.com\/#website","url":"https:\/\/mymonkeydo.com\/","name":"My Monkey Do","description":"A Log of Coding Solutions","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mymonkeydo.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/mymonkeydo.com\/#\/schema\/person\/b16fc650a8c182faaac896bab099b829","name":"Webhead","url":"https:\/\/mymonkeydo.com\/author\/corey\/"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/posts\/554"}],"collection":[{"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/comments?post=554"}],"version-history":[{"count":1,"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/posts\/554\/revisions"}],"predecessor-version":[{"id":1571,"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/posts\/554\/revisions\/1571"}],"wp:attachment":[{"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/media?parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/categories?post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mymonkeydo.com\/wp-json\/wp\/v2\/tags?post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}