{"id":326,"date":"2015-08-09T11:31:54","date_gmt":"2015-08-09T11:31:54","guid":{"rendered":"https:\/\/www.armourinfosec.com\/?p=326"},"modified":"2017-01-18T10:01:04","modified_gmt":"2017-01-18T04:31:04","slug":"linux-commands","status":"publish","type":"post","link":"https:\/\/www.armourinfosec.com\/linux-commands\/","title":{"rendered":"Linux Commands"},"content":{"rendered":"

\"Linux<\/a><\/p>\n

    \n
  1. ls -l<\/strong> for listing the files as well as directories those are kept in the particular working directory<\/li>\n<\/ol>\n

    [root@armourinfosec ~]# ls \u2013l<\/p>\n

      \n
    1. ls -la<\/strong> same as ‘ls -l’ but by this command we can also see the hidden files<\/li>\n<\/ol>\n

      [root@armourinfosec ~]#ls \u2013la<\/p>\n

        \n
      1. ls -li<\/strong> same as ‘ls -la’ but it will also shows us the inode number of each and every file<\/li>\n<\/ol>\n

        [root@armourinfosec ~]#ls \u2013li<\/p>\n

          \n
        1. ls<\/strong> by this command we can see only file name nothing else<\/li>\n<\/ol>\n

          [root@armourinfosec ~]#ls<\/p>\n

            \n
          1. clear<\/strong> it will clear the screen ( short cut ctl + l )<\/li>\n<\/ol>\n

            [root@armourinfosec ~]#clear<\/p>\n

              \n
            1. exit <\/strong>to end a current session as well current terminal logging<\/li>\n<\/ol>\n

              [root@armourinfosec ~]#exit<\/p>\n

                \n
              1. touch <\/strong>to create a new empty file<\/li>\n<\/ol>\n

                [root@armourinfosec ~]#touch myfile.txt<\/p>\n

                  \n
                1. cd<\/strong> to change the working\/present directory<\/li>\n<\/ol>\n

                  [root@armourinfosec ~]#cd \/home\/sachin<\/p>\n

                    \n
                  1. cat<\/strong> to view the contents of a file and it is also used for creating a new file with some contents<\/li>\n<\/ol>\n

                    [root@armourinfosec ~]#cat <file name> to view file contents<\/p>\n

                    [root@armourinfosec ~]#cat > newfilename enter, then you can write something in the file and then to save the file contents press clt+d then enter<\/p>\n

                     <\/p>\n

                      \n
                    1. mkdir<\/strong> to make a new directory<\/li>\n<\/ol>\n

                      [root@armourinfosec ~]#mkdir newdirname<\/p>\n

                      you can also create a directory at your desired path without changing your present working directory<\/p>\n

                      [root@armourinfosec ~]#mkdir \/home\/sachin\/newdirname<\/p>\n

                        \n
                      1. rm<\/strong> to remove a empty file<\/li>\n<\/ol>\n

                        [root@armourinfosec ~]#rm filename<\/p>\n

                          \n
                        1. rmdir<\/strong> to remove a empty directory<\/li>\n<\/ol>\n

                          [root@armourinfosec ~]#rmdir directoryname<\/p>\n

                            \n
                          1. rm<\/strong> [-i\/-r\/-f] to remove a directory with its subdirectories as well as its<\/li>\n<\/ol>\n

                            files that is to remove a directory which already contains some files in it<\/p>\n

                            [root@armourinfosec ~]#rm -i directory\/filename<\/p>\n

                            -i stands for interactively<\/p>\n

                            -r stands for recursively<\/p>\n

                            -f stands for forcefully<\/p>\n

                              \n
                            1. cp <\/strong>to copy something in a destination file or directory<\/li>\n<\/ol>\n

                              [root@armourinfosec ~]#cp sourcepath destinationpath<\/p>\n

                              [root@armourinfosec ~]#cp \/home\/sachin\/webmin.rpm \/root\/abcd<\/p>\n

                               <\/p>\n

                              in this example the webmin.rpm file will be copied in<\/p>\n

                              \/root\/abcd directory<\/p>\n

                                \n
                              1. mv<\/strong> to move one file or directory from one place to another place, it is also used for renaming adirectory or file<\/li>\n<\/ol>\n

                                [root@armourinfosec ~]#mv source destination<\/p>\n

                                [root@armourinfosec ~]#mv oldfilename newfilename [to change the file name]<\/p>\n

                                 <\/p>\n

                                  \n
                                1. man <\/strong>to view the mannual page of commands for syntax<\/li>\n<\/ol>\n

                                  [root@armourinfosec ~]#man commandname<\/p>\n

                                    \n
                                  1. info<\/strong> to view the information about any command<\/li>\n<\/ol>\n

                                    [root@armourinfosec ~]#mkdir info<\/p>\n

                                      \n
                                    1. –help<\/strong> to view the help doccuments of a command<\/li>\n<\/ol>\n

                                      [root@armourinfosec ~]#commandname \u2013help<\/p>\n

                                        \n
                                      1. dir <\/strong> to view the subdirectories and filesn under the directory<\/li>\n<\/ol>\n

                                        [root@armourinfosec ~]#dir<\/p>\n

                                          \n
                                        1. who<\/strong> by this command you can see the user name and their ip addresses who have loged in on your server<\/li>\n<\/ol>\n

                                          [root@armourinfosec ~]#who<\/p>\n

                                            \n
                                          1. whoami <\/strong> this command shows your current logged in terminal user name<\/li>\n<\/ol>\n

                                            [root@armourinfosec ~]#whoami<\/p>\n

                                              \n
                                            1. who am i<\/strong> this command shows you the logged in terminal number and user name and more detailed information<\/li>\n<\/ol>\n

                                              [root@armourinfosec ~]#who am i<\/p>\n

                                                \n
                                              1. pwd<\/strong> to view the present working directory<\/li>\n<\/ol>\n

                                                [root@armourinfosec ~]#pwd<\/p>\n

                                                  \n
                                                1. rpm -ivh<\/strong> to intall a rpm package<\/li>\n<\/ol>\n

                                                  [root@armourinfosec ~]#rpm -ivh packagename.rpm<\/p>\n

                                                  rpm stands for ‘redhat package manager’<\/p>\n

                                                  -i stands for install<\/p>\n

                                                  -v stands for verbose mode<\/p>\n

                                                  -h stands for with hash sign(#)<\/p>\n

                                                    \n
                                                  1. rpm -q<\/strong> to querry about any rpm package<\/li>\n<\/ol>\n

                                                    [root@armourinfosec ~]#rpm -q packagename<\/p>\n

                                                      \n
                                                    1. rpm -e<\/strong> to uninstall a rpm package<\/li>\n<\/ol>\n

                                                      [root@armourinfosec ~]#rpm -e package<\/p>\n

                                                        \n
                                                      1. find \/ -name<\/strong> to find any file or directory in linux file system<\/li>\n<\/ol>\n

                                                        [root@armourinfosec ~]#find \/ -name filename<\/p>\n

                                                          \n
                                                        1. su username<\/strong> to switch from one user to another users home directory<\/li>\n<\/ol>\n

                                                          [root@armourinfosec ~]#su sachin<\/p>\n

                                                            \n
                                                          1. su – username<\/strong> to switch from one user to another user users home directory directly<\/li>\n<\/ol>\n

                                                            [root@armourinfosec ~]#su \u2013 sachin<\/p>\n

                                                              \n
                                                            1. useradd<\/strong> to create a new user<\/li>\n<\/ol>\n

                                                              [root@armourinfosec ~]#useradd username<\/p>\n

                                                                \n
                                                              1. passwd<\/strong> to give a password of a user<\/li>\n<\/ol>\n

                                                                [root@armourinfosec ~]#passwd sachin<\/p>\n

                                                                give a password for user sachin:(here you have to type a password for sachin user) Confirm password:(again type the same password)<\/p>\n

                                                                  \n
                                                                1. userdel <\/strong>to remove a user from linux<\/li>\n<\/ol>\n

                                                                  [root@armourinfosec ~]#userdel sachin<\/p>\n

                                                                    \n
                                                                  1. groupadd<\/strong> to add a new group<\/li>\n<\/ol>\n

                                                                    [root@armourinfosec ~]#groupadd groupname<\/p>\n

                                                                      \n
                                                                    1. gruopdel<\/strong> to delete a group<\/li>\n<\/ol>\n

                                                                      [root@armourinfosec ~]#groupdel groupname<\/p>\n

                                                                        \n
                                                                      1. chown<\/strong> to change the ownership of a file or directory<\/li>\n<\/ol>\n

                                                                        [root@armourinfosec ~]#chown ownername filename<\/p>\n

                                                                          \n
                                                                        1. chgrp<\/strong> to change the group ownership of a file or directory<\/li>\n<\/ol>\n

                                                                          [root@armourinfosec ~]#chgrp newgroupownername filename<\/p>\n

                                                                            \n
                                                                          1. usermod <\/strong> to modify the user profile<\/li>\n<\/ol>\n

                                                                            [root@ armourinfosec ~]#usermod -parameter groupname username<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":844,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"yoast_head":"\nlinux commands for beginners | linux commands for hacking<\/title>\n<meta name=\"description\" content=\"ls -l for listing the files as well as directories those are kept in the particular working directory\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.armourinfosec.com\/linux-commands\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"linux commands for beginners | linux commands for hacking\" \/>\n<meta property=\"og:description\" content=\"ls -l for listing the files as well as directories those are kept in the particular working directory\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.armourinfosec.com\/linux-commands\/\" \/>\n<meta property=\"og:site_name\" content=\"Armour Infosec\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ArmourInfosec\" \/>\n<meta property=\"article:published_time\" content=\"2015-08-09T11:31:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-01-18T04:31:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.armourinfosec.com\/wp-content\/uploads\/2015\/08\/Linux-Commands.png\" \/>\n\t<meta property=\"og:image:width\" content=\"450\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Armour Infosec\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ArmourInfosec\" \/>\n<meta name=\"twitter:site\" content=\"@ArmourInfosec\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Armour Infosec\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.armourinfosec.com\/linux-commands\/\",\"url\":\"https:\/\/www.armourinfosec.com\/linux-commands\/\",\"name\":\"linux commands for beginners | linux commands for hacking\",\"isPartOf\":{\"@id\":\"https:\/\/www.armourinfosec.com\/#website\"},\"datePublished\":\"2015-08-09T11:31:54+00:00\",\"dateModified\":\"2017-01-18T04:31:04+00:00\",\"author\":{\"@id\":\"https:\/\/www.armourinfosec.com\/#\/schema\/person\/1d8ec30560e735c34fa5d464a1357308\"},\"description\":\"ls -l for listing the files as well as directories those are kept in the particular working directory\",\"breadcrumb\":{\"@id\":\"https:\/\/www.armourinfosec.com\/linux-commands\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.armourinfosec.com\/linux-commands\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.armourinfosec.com\/linux-commands\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.armourinfosec.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.armourinfosec.com\/#website\",\"url\":\"https:\/\/www.armourinfosec.com\/\",\"name\":\"Armour Infosec\",\"description\":\"Do Your Part - Be Security Smart\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.armourinfosec.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.armourinfosec.com\/#\/schema\/person\/1d8ec30560e735c34fa5d464a1357308\",\"name\":\"Armour Infosec\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.armourinfosec.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/17f812901d8294702576e81ddce5aa92?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/17f812901d8294702576e81ddce5aa92?s=96&d=mm&r=g\",\"caption\":\"Armour Infosec\"},\"sameAs\":[\"https:\/\/www.armourinfosec.com\/\"],\"url\":\"https:\/\/www.armourinfosec.com\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"linux commands for beginners | linux commands for hacking","description":"ls -l for listing the files as well as directories those are kept in the particular working directory","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:\/\/www.armourinfosec.com\/linux-commands\/","og_locale":"en_US","og_type":"article","og_title":"linux commands for beginners | linux commands for hacking","og_description":"ls -l for listing the files as well as directories those are kept in the particular working directory","og_url":"https:\/\/www.armourinfosec.com\/linux-commands\/","og_site_name":"Armour Infosec","article_publisher":"https:\/\/www.facebook.com\/ArmourInfosec","article_published_time":"2015-08-09T11:31:54+00:00","article_modified_time":"2017-01-18T04:31:04+00:00","og_image":[{"width":450,"height":300,"url":"https:\/\/www.armourinfosec.com\/wp-content\/uploads\/2015\/08\/Linux-Commands.png","type":"image\/png"}],"author":"Armour Infosec","twitter_card":"summary_large_image","twitter_creator":"@ArmourInfosec","twitter_site":"@ArmourInfosec","twitter_misc":{"Written by":"Armour Infosec","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.armourinfosec.com\/linux-commands\/","url":"https:\/\/www.armourinfosec.com\/linux-commands\/","name":"linux commands for beginners | linux commands for hacking","isPartOf":{"@id":"https:\/\/www.armourinfosec.com\/#website"},"datePublished":"2015-08-09T11:31:54+00:00","dateModified":"2017-01-18T04:31:04+00:00","author":{"@id":"https:\/\/www.armourinfosec.com\/#\/schema\/person\/1d8ec30560e735c34fa5d464a1357308"},"description":"ls -l for listing the files as well as directories those are kept in the particular working directory","breadcrumb":{"@id":"https:\/\/www.armourinfosec.com\/linux-commands\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.armourinfosec.com\/linux-commands\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.armourinfosec.com\/linux-commands\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.armourinfosec.com\/"},{"@type":"ListItem","position":2,"name":"Linux Commands"}]},{"@type":"WebSite","@id":"https:\/\/www.armourinfosec.com\/#website","url":"https:\/\/www.armourinfosec.com\/","name":"Armour Infosec","description":"Do Your Part - Be Security Smart","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.armourinfosec.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.armourinfosec.com\/#\/schema\/person\/1d8ec30560e735c34fa5d464a1357308","name":"Armour Infosec","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.armourinfosec.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/17f812901d8294702576e81ddce5aa92?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/17f812901d8294702576e81ddce5aa92?s=96&d=mm&r=g","caption":"Armour Infosec"},"sameAs":["https:\/\/www.armourinfosec.com\/"],"url":"https:\/\/www.armourinfosec.com\/author\/admin\/"}]}},"menu_order":0,"_links":{"self":[{"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/posts\/326"}],"collection":[{"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/comments?post=326"}],"version-history":[{"count":0,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/posts\/326\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/media\/844"}],"wp:attachment":[{"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/media?parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/categories?post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.armourinfosec.com\/wp-json\/wp\/v2\/tags?post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}