{"id":3883,"date":"2018-11-20T00:26:28","date_gmt":"2018-11-20T00:26:28","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=3883"},"modified":"2018-12-07T02:03:26","modified_gmt":"2018-12-07T02:03:26","slug":"cheat-sheet-of-useful-commands-every-kali-linux-user-needs-to-know","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/20\/cheat-sheet-of-useful-commands-every-kali-linux-user-needs-to-know\/","title":{"rendered":"Cheat Sheet of Useful Commands Every Kali Linux User Needs To Know"},"content":{"rendered":"<p>This cheat sheet includes a list of basic and useful Linux commands that every Kali Linux user needs to know.<\/p>\n<p>If you want to learn how to hack with Kali Linux, the most important thing you should do first is to master the command line interface.<\/p>\n<p>Here&#8217;s why:<\/p>\n<p>Tasks that take minutes or even hours to do on a desktop environment (GUI) can be done in a matter of seconds from the command line.<\/p>\n<p>For example:<\/p>\n<p>To download an entire HTML website, you only need to type:<\/p>\n<p><em>wget -r domain.com<\/em><\/p>\n<p>Now if you were to do the same on a GUI, you&#8217;d have to save each page one by one.<\/p>\n<p>This is only one of many examples as to how powerful the command line is. There are many other tasks on Linux that can <em>only<\/em> be done from the command line.<\/p>\n<p>In short:<\/p>\n<p>Knowing your way around a command line will make you a more efficient and effective programmer. You&#8217;ll be able to get shit done faster by automating repetitive tasks. \u200b<\/p>\n<p>\u200bPlus, you&#8217;ll look like a complete bad ass in the process.<\/p>\n<p>Use this cheat sheet as a reference in case you forget how to do certain tasks from the command-line. And trust me, it happens.<\/p>\n<p>If you&#8217;re new to Unix\/Linux operating systems, this cheat sheet also includes the fundamental linux commands such as jumping from one directory to another, as well as more technical stuff like managing processes.<\/p>\n<p>NOTES<br \/>\nEverything inside &#8220;&lt;&gt;&#8221; should be replaced with a name of a file, directory or command.<\/p>\n<p>Bash = A popular command-line used in Unix\/Linux operating systems.<\/p>\n<p>dir = directory\/folder<br \/>\nfile = file name &amp; type (eg. notes.txt)<br \/>\ncmd = command (eg. mkdir, ls, curl, etc)<br \/>\nlocation = path\/destination (eg. \/home\/Desktop)<\/p>\n<p>pwd: Display path of current directory you\u2019re in<\/p>\n<p>\u200bls: List all files and folders in the current directory<br \/>\nls -la: List detailed list of files and folders, including hidden ones<\/p>\n<h5>Change to a specific directory<\/h5>\n<p>cd: Change to home directory<br \/>\ncd \/user\/Desktop: Change to a specific directory called Desktop<br \/>\ncd .. : Move back a directory<\/p>\n<h5>Create a directory\/folder<\/h5>\n<p>mkdir &lt;dir&gt;: Create a new directory<br \/>\nmkdir \/home\/Desktop\/dir: Create a directory in a specific location<\/p>\n<h5>Create and edit files<\/h5>\n<p>touch &lt;file&gt;: Create an empty file<br \/>\nnano &lt;file&gt;: Edit an existing file or create it if it doesn\u2019t exist.<br \/>\n<em>Alternatives to nano text editor: vim, emacs<\/em><\/p>\n<h5>Copy, move and rename files and directories<\/h5>\n<p>cp &lt;file1&gt; &lt;file2&gt;: Create a copy of a file<br \/>\ncp -r &lt;dir1&gt; &lt;dir2&gt;: Create a copy of a directory and everything in it<br \/>\ncp &lt;file&gt; \/home\/Desktop\/file2: Create a copy of a file in a different directory and name it file2.<\/p>\n<p>mv &lt;file&gt; \/home\/Desktop: Move a file to a specific directory (overwrites any existing file with the same name)<br \/>\nmv &lt;dir&gt; \/home\/Desktop: Move a directory to another location<br \/>\nmv &lt;dir1&gt; &lt;dir2&gt;: Rename a file OR directory (dir1 -&gt; dir2)<\/p>\n<h5>Delete files<\/h5>\n<p>rm &lt;file&gt;: Delete a file<br \/>\nrm -f &lt;file&gt;: Force delete a file<br \/>\n<em>Careful now..<\/em><\/p>\n<p>rm -r &lt;dir&gt;: Delete a directory and its contents<br \/>\nrm -rf &lt;dir&gt;: Force delete a directory and its contents<br \/>\n<em>Careful when using this command as it will delete everything inside the directory<\/em><\/p>\n<h5>Output and analyze files<\/h5>\n<p>cat &lt;file&gt;: Display\/output the contents of a file<br \/>\nless &lt;file&gt;: Display the contents of a file with scroll (paginate) ability (press q to quit)<\/p>\n<p>head &lt;file&gt;: Display the first ten lines in a file<br \/>\nhead -20 &lt;file&gt;: Display the first 20 lines in a file<br \/>\ntail &lt;file&gt;: Display the last ten lines in a file<br \/>\ntail -20 &lt;file&gt;: Display the last 20 lines in a file<\/p>\n<p>diff &lt;file1&gt; &lt;file2&gt;: Check the difference between two files (file1 and file2)<\/p>\n<p>cal: Display monthly calendar<\/p>\n<p>date: Check date and time<br \/>\n<b>uptime<\/b>: Check system uptime and currently logged in users<\/p>\n<p>uname -a: Display system information.<br \/>\n<b>dmesg: <\/b>Display kernel ring buffer<\/p>\n<p>poweroff: Shutdown system<br \/>\nreboot: Reboot system<\/p>\n<h5>View disk and memory usage<\/h5>\n<p>df -h: Display disk space usage<br \/>\nfdisk -l: List disk partition tables<br \/>\nfree: Display memory usage<\/p>\n<p>cat \/proc\/meminfo: Display memory information<br \/>\ncat \/proc\/cpuinfo: Display cpu information<\/p>\n<h5>View user information<\/h5>\n<p>whoami: Output your username<br \/>\nw: Check who\u2019s online<\/p>\n<p>history: View a list of your previously executed commands<\/p>\n<h5>View last logged in users and information<\/h5>\n<p>last: Display last login info of users<br \/>\nlast &lt;user&gt;: Display last login info of a specific user<\/p>\n<p>finger &lt;user&gt;: Display user information<\/p>\n<h2>Installing &amp; Upgrading Packages<\/h2>\n<h5>Search for packages<\/h5>\n<p>apt-cache pkgnames: List all available packages<br \/>\napt search &lt;name&gt;: Search for a package and its description<br \/>\napt show &lt;name&gt;: Check detailed description of a package<\/p>\n<h5>Install packages<\/h5>\n<p>apt-get install &lt;name&gt;: Install a package<br \/>\napt-get install &lt;name1&gt; &lt;name2&gt;: Install multiple packages<\/p>\n<h5>Update, upgrade &amp; cleanup<\/h5>\n<p>apt-get update: Update list of available packages<br \/>\napt-get upgrade: Install the newest version of available packages<br \/>\napt-get dist-upgrade: Force upgrade packages.<br \/>\napt-get autoremove: Remove installed packages that are no longer needed<br \/>\napt-get clean: Free up disk space by removing archived packages<\/p>\n<h5>Delete packages<\/h5>\n<p><b>apt-get remove: <\/b>Uninstall a package<br \/>\n<b>apt-get remove &#8211;purge: <\/b>Uninstall a package and remove its configuration files<\/p>\n<h2>Processes &amp; Job Management<\/h2>\n<p>top: Display running processes &amp; system usage in real-time.<\/p>\n<p>ps: Display currently running processes<br \/>\nps -u &lt;user&gt;: Display currently running processes of a user<\/p>\n<p>kill &lt;PID&gt;: Kill a processes by PID #.<br \/>\nkillall &lt;processes&gt;: Kill all processes with specified name.<\/p>\n<h5>Start, stop, resume jobs<\/h5>\n<p>jobs: Display the status of current jobs<br \/>\njobs -l: Display detailed info about each job<br \/>\njobs -r: Display only running jobs<\/p>\n<p>bg: View stopped background jobs or resume job in the background<br \/>\nfg: Resume recent job in the foreground<br \/>\nfg &lt;job&gt;: Bring specific job to the foreground.<\/p>\n<p>ping &lt;host&gt;: Ping a host<br \/>\nwhois &lt;domain\/IP&gt;: Get whois information about a domain or IP.<br \/>\ndig &lt;domain\/IP&gt;: Get DNS information<br \/>\nnslookup: &lt;NS&gt;: Get nameserver information<\/p>\n<p>ifconfig: Configure\/display network interfaces<br \/>\niwconfig: Configure\/display wireless network interfaces<\/p>\n<p>netstat -r: Display kernel IP routing tables<br \/>\nnetstat -antp: Check for established and listening ports\/connections\u200b<\/p>\n<p>arp -a: Display ARP cache tables for all interfaces\u200b<\/p>\n<h5>Secure File Transfer (SCP)<\/h5>\n<p>Transfer files FROM the local system TO a remote host (Local &gt; Remote)<br \/>\nscp \/path\/to\/file <a href=\"\/cdn-cgi\/l\/email-protection\">[email protected]<\/a>:\/path\/to\/dest<\/p>\n<p>Transfer files FROM a remote host TO the local system (Remote &gt; Local)<br \/>\nscp <a href=\"\/cdn-cgi\/l\/email-protection\">[email protected]<\/a>:\/path\/to\/file \/path\/to\/dest<\/p>\n<p>Transfer directories and everything within it<br \/>\nscp -r \/path\/to\/dir <a href=\"\/cdn-cgi\/l\/email-protection\">[email protected]<\/a>:\/path\/to\/dest<\/p>\n<p>Transfer all files that match a specific filetype<br \/>\nscp \/path\/to\/*.txt <a href=\"\/cdn-cgi\/l\/email-protection\">[email protected]<\/a>:\/path\/to\/dest<\/p>\n<p>Transfer local public SSH public key to remote host<br \/>\ncat ~\/.ssh\/id_rsa.pub | ssh <a href=\"\/cdn-cgi\/l\/email-protection\">[email protected]<\/a> &#8216;cat &gt;&gt; .ssh\/authorized_keys&#8217;<\/p>\n<p>Am I forgetting something? Let me know in the comments below. I&#8217;ll continue to update this when I get a chance.<\/p>\n<p><a href=\"https:\/\/kennyvn.com\/cheatsheet-useful-bash-commands-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This cheat sheet includes a list of basic and useful Linux commands that every Kali Linux user needs to know. If you want to learn how to hack with Kali Linux, the most important thing you should do first is to master the command line interface. Here&#8217;s why: Tasks that take minutes or even hours &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/11\/20\/cheat-sheet-of-useful-commands-every-kali-linux-user-needs-to-know\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Cheat Sheet of Useful Commands Every Kali Linux User Needs To Know&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3883","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/3883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=3883"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/3883\/revisions"}],"predecessor-version":[{"id":4618,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/3883\/revisions\/4618"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=3883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=3883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=3883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}