{"id":286,"date":"2008-01-08T08:24:49","date_gmt":"2008-01-08T12:24:49","guid":{"rendered":"http:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/"},"modified":"2008-01-08T08:24:49","modified_gmt":"2008-01-08T12:24:49","slug":"linuxunix-basics","status":"publish","type":"post","link":"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/","title":{"rendered":"Linux\/Unix Basics"},"content":{"rendered":"<p>&#8216;<strong>ROOT<\/strong>&#8216; on linux is the centre of all power.\u00a0This account\/user\u00a0is the system administrator who has the access to all files &amp; folders &amp; can add or delete users or change their passwords.<\/p>\n<p>Some of the basic commands used on linux useful for Oracle Apps DBA&#8217;s are:<\/p>\n<p><strong>1. useradd <\/strong><br \/>\nThe general syntax for the useradd command is :<\/p>\n<p>useradd -d home_directory -e expire_date -g initial_group -p password login_name<\/p>\n<p>home_directory : Is the main directory within which the user is expected to store all his files and subdirectories.<br \/>\nFor a user named &#8216;neha&#8217; the home directory generally is \/home\/neha<br \/>\nexpire_date : This is the date on which the user&#8217;s account expires and he\/she cannot access the computer anymore unless the account is renewed.<br \/>\ninitial_group : Every user in Linux belongs to a group which affects his file permissions. The initial group must be a group which already exists.<br \/>\nPassword : This will be the user&#8217;s password to access his account<br \/>\nlogin_name : This will be the user name with which the user will access his account.<\/p>\n<p>Eg :<\/p>\n<p><em>useradd -d \/home\/neha -e 2009-12-03 -g root -p talent123 neha<br \/>\n<\/em><\/p>\n<p>creates a user named neha on my computer.<\/p>\n<p>Home directory for user Neha is \/home\/neha<br \/>\nExpirty date is 3rd december,2009<br \/>\nBelongs to the &#8216;root&#8217; group<br \/>\nPassword is talent123<\/p>\n<p>Incase you do not enter one of the parameters group, home, expire or shell they are replaced by their default values. These default values can be viewed using the &#8220;<em> useradd -D&#8221; <\/em>command and can also be changed.<\/p>\n<p><strong>2) ls <\/strong><br \/>\nThe <strong>ls <\/strong>command is equivalent of the DOS <strong>dir<\/strong> command. It lists the files and subdirectories contained within the present directory.<\/p>\n<p>Some possible flags which can be used with the ls command are :<\/p>\n<p><em><strong>ls -l\u00a0<\/strong><\/em><\/p>\n<p>Uses a long listing format,which contains lots of useful information,like the exact size of file,who owns the file\u00a0, who has the right to look at it &amp; when it was last modified.<br \/>\n<em><strong>ls -a<\/strong><\/em><\/p>\n<p>List all files including the one&#8217;s starting with &#8216;.&#8217; (Some configuration files starting with a dot &#8216;.&#8217; are otherwise not listed).<\/p>\n<p><strong><em>ls<\/em> | <em>more<\/em><\/strong><\/p>\n<p>Lists files and directories page after page on keystroke. The above command actually is a combination of two commands. It introduces a new concept called &#8216;Piping&#8217;.\u00a0 In Linux it is possible to give the output of one command to another command as an input.The ls command lists files &amp; subdirectories and the more commands divides its input into page length views. Thus piping the ls output to more results in page length views of files and subdirectories.<\/p>\n<p><em><strong>ls -R<\/strong><\/em><\/p>\n<p>It lists the files and subdirectories of a directory and further lists the contents of each subdirectory recursively<strong><em>. <\/em><\/strong><\/p>\n<p><strong>3)\u00a0pwd<br \/>\n<\/strong>The pwd or the present working directory command gives you the path to the directory in which you presently are. It is used without flags simply as &#8216;pwd&#8217;<\/p>\n<p><strong>4) su <\/strong><\/p>\n<p>Many a times you might have logged in as a normal user and might need to be root (or any other user)\u00a0to install a software or for some other small task. You could logout then login as\u00a0that particular user,\u00a0complete the work logout and login back as a normal user. Instead, you can just use the <strong>su<\/strong> command. The format is :<\/p>\n<p><strong>su {username}<\/strong><\/p>\n<p>eg : su root<\/p>\n<p>when you &#8216;su&#8217; to become root from a normal user, you are asked for the root password. But if you are root, you can use &#8216;su&#8217; to become any user without using a password. Once your work is finished, use &#8216;exit&#8217; to become yourself.<\/p>\n<p><strong><em>* Check for &#8211; (hyphen) with su command <\/em><\/strong><\/p>\n<p><strong>5)<\/strong> <strong>whoami<br \/>\n<\/strong>Will tell you which user you are logged in as. Useful when you have used &#8216;su&#8217; many times and now don&#8217;t know who you are.<\/p>\n<p><strong>6) cp<br \/>\n<\/strong>This one copies files \/ directories from one place to another .It&#8217;s syntax is<\/p>\n<p><strong>cp source_file_path destination_path<\/strong><\/p>\n<p>eg : cp \/home\/neha\/abctxt\u00a0 \/ftp\/xyz<\/p>\n<p>The cp command can be used with some useful flags also :<\/p>\n<p><strong>cp -i<\/strong><\/p>\n<p>Interactive copying, prompts before overwriting files or directories<\/p>\n<p><strong>cp -l source_file_with_path destination_path<\/strong><\/p>\n<p>Makes a link (shortcut) to the source_file at the destination path instead of actually copying it there.<\/p>\n<p><strong>cp -p<\/strong><\/p>\n<p>Preserve file attributes while copying if possible<\/p>\n<p><strong>cp -R<\/strong><\/p>\n<p>Copy Recursively . Used when copying directories. This command also copies the contents of the subdirectories.<\/p>\n<p><strong>cp -u<\/strong><\/p>\n<p>Update i.e. Copy only if the source file is newer than the destination file or the destination file does not exist.<\/p>\n<p><strong>7)\u00a0rm <\/strong><br \/>\nThe rm command is used to remove or delete files or directories. Its general syntax is:<\/p>\n<p><strong>rm -flag file_or_directory_with_path<\/strong><\/p>\n<p>eg : rm \/home\/neha\/scrap.txt<\/p>\n<p>Some flags which can be used with the rm command are<\/p>\n<p><strong><em>rm -v file.txt<\/em><\/strong><\/p>\n<p>Remove verbosely, explain what is being done.<\/p>\n<p><strong><em>rm -r my_directory<\/em><\/strong><\/p>\n<p>Remove the directory and its contents recursively.<\/p>\n<p><strong>8) mkdir<\/strong><\/p>\n<p>This command is used to create new a new directory. Its syntax is<\/p>\n<p><strong>mkdir -optional_flag directory_name<\/strong><\/p>\n<p>The possible flags are<\/p>\n<p><em><strong>mkdir -v directory_name<\/strong><\/em><\/p>\n<p><em>Tell what is going on.<\/em><em><em><strong>mkdir -p directory_with_path<\/strong><\/em><\/em><\/p>\n<p>\u00a0Suppose you need a directory named\u00a0ABC within another directory called\u00a0XYZ in \/usr\/local and the parent directory XYZ\u00a0itself does not exist, then you can use :<\/p>\n<p>mkdir -p \/usr\/local\/XYZ\/ABC<\/p>\n<p>This command creates the\u00a0XYZ directory and the\u00a0ABC subdirectory in one go.<\/p>\n<p><strong>9) man<br \/>\n<\/strong>Suppose you have not understood fully one of the above commands or want to find out about a new command you have learnt , the man command provides a manual for that command. The syntax is:<\/p>\n<p><strong>man command_name<\/strong><\/p>\n<p>Thus<\/p>\n<p><strong>man cp<\/strong><\/p>\n<p>will show you a manual on the cp command and so on<\/p>\n<p><strong>More on linux basics coming soon &#8230;.<br \/>\n<\/strong><br \/>\n<strong>Related<br \/>\n<a href=\"https:\/\/onlineappsdba.com\/index.php\/2007\/12\/11\/linux-common-queries\/\">https:\/\/onlineappsdba.com\/index.php\/2007\/12\/11\/linux-common-queries\/<\/a><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8216;ROOT&#8216; on linux is the centre of all power.\u00a0This account\/user\u00a0is the system administrator who has the access to all files [&hellip;]<\/p>\n","protected":false},"author":115,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[134],"tags":[],"class_list":["post-286","post","type-post","status-publish","format-standard","hentry","category-unix"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux\/Unix Basics -<\/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:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux\/Unix Basics -\" \/>\n<meta property=\"og:description\" content=\"&#8216;ROOT&#8216; on linux is the centre of all power.\u00a0This account\/user\u00a0is the system administrator who has the access to all files [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/\" \/>\n<meta property=\"article:published_time\" content=\"2008-01-08T12:24:49+00:00\" \/>\n<meta name=\"author\" content=\"Masroof Ahmad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Masroof Ahmad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/\",\"url\":\"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/\",\"name\":\"Linux\/Unix Basics -\",\"isPartOf\":{\"@id\":\"https:\/\/onlineappsdba.com\/#website\"},\"datePublished\":\"2008-01-08T12:24:49+00:00\",\"author\":{\"@id\":\"https:\/\/onlineappsdba.com\/#\/schema\/person\/909a876ed58d400faf82caf81d61bfdb\"},\"breadcrumb\":{\"@id\":\"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/onlineappsdba.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux\/Unix Basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/onlineappsdba.com\/#website\",\"url\":\"https:\/\/onlineappsdba.com\/\",\"name\":\"\",\"description\":\"Oracle Implementation &amp; Training Experts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/onlineappsdba.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/onlineappsdba.com\/#\/schema\/person\/909a876ed58d400faf82caf81d61bfdb\",\"name\":\"Masroof Ahmad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/onlineappsdba.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/10f9db7bdbbd7f9ccfbe9b2d208e5978fc28315e9c704383e639a926ea0fce5f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/10f9db7bdbbd7f9ccfbe9b2d208e5978fc28315e9c704383e639a926ea0fce5f?s=96&d=mm&r=g\",\"caption\":\"Masroof Ahmad\"},\"url\":\"https:\/\/onlineappsdba.com\/index.php\/author\/masroof\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux\/Unix Basics -","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:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/","og_locale":"en_US","og_type":"article","og_title":"Linux\/Unix Basics -","og_description":"&#8216;ROOT&#8216; on linux is the centre of all power.\u00a0This account\/user\u00a0is the system administrator who has the access to all files [&hellip;]","og_url":"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/","article_published_time":"2008-01-08T12:24:49+00:00","author":"Masroof Ahmad","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Masroof Ahmad","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/","url":"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/","name":"Linux\/Unix Basics -","isPartOf":{"@id":"https:\/\/onlineappsdba.com\/#website"},"datePublished":"2008-01-08T12:24:49+00:00","author":{"@id":"https:\/\/onlineappsdba.com\/#\/schema\/person\/909a876ed58d400faf82caf81d61bfdb"},"breadcrumb":{"@id":"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/onlineappsdba.com\/index.php\/2008\/01\/08\/linuxunix-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/onlineappsdba.com\/"},{"@type":"ListItem","position":2,"name":"Linux\/Unix Basics"}]},{"@type":"WebSite","@id":"https:\/\/onlineappsdba.com\/#website","url":"https:\/\/onlineappsdba.com\/","name":"","description":"Oracle Implementation &amp; Training Experts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/onlineappsdba.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/onlineappsdba.com\/#\/schema\/person\/909a876ed58d400faf82caf81d61bfdb","name":"Masroof Ahmad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/onlineappsdba.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/10f9db7bdbbd7f9ccfbe9b2d208e5978fc28315e9c704383e639a926ea0fce5f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/10f9db7bdbbd7f9ccfbe9b2d208e5978fc28315e9c704383e639a926ea0fce5f?s=96&d=mm&r=g","caption":"Masroof Ahmad"},"url":"https:\/\/onlineappsdba.com\/index.php\/author\/masroof\/"}]}},"_links":{"self":[{"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/posts\/286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"count":0,"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"wp:attachment":[{"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/media?parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/onlineappsdba.com\/index.php\/wp-json\/wp\/v2\/tags?post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}