Hack Like a Pro: Linux Basics for the Aspiring Hacker, Part 2 (Creating Directories & Files) « Null Byte :: WonderHowTo

In myfirst tutorial on Linux basics, I discussed the importance of hackers using Linux and the structure of the directory system. We also looked briefly at thecdcommand. In this second Linux guide, I'll spend a bit more time with changing directories, listing directories, creating files and directories, and finally, getting help.Let's open upBackTrackand getting started learning more Linux for the aspiring hacker.Step 1: Change Directory (Cd)We can change directories in multiple ways withcd. As I showed you inmy previous article, we can usecd ..to move up one level in the directory tree. We can also move directly to the root directory by typingcd /or move to our home directory bycd ~.More often, we will usecdto move to a directory by using the absolute path of the directory. This mean that we write out the entire path of the directory we want to move to aftercd. We can also move to the directory by using the relative path of the directory. This means that we don't need to write the entire path, but simply use the path that we're currently in and append to it. Let's look at some examples.Let's say we're in our root user directory inBackTrackand we want to move to theaircrack-ngdirectory (we'll be doing some aircrack tutorials soon). We can simply type:bt > cd /pentest/wireless/aircrack-ngThis will take us directly to theaircrack-ngdirectory.Now let's say we want to go to thescripts sub-directorywithinaircrack-ng. We could type out the full path to the sub-directory, but it's much simpler to type the relative path from where we are. We know we are/pentest/wireless/aircrack-ng, so type:bt > cd scriptsAnd that takes us to thescripts sub-directorywithinaircrack-ngor/pentest/wireless/aircrack-ng/scripts.Once again, it's critical to emphasize that Linux is case sensitive, so typing the directory without the proper case will result in the error message, "no such file or directory".Step 2: Listing Command (Ls)Once of most used and important commands in Linux islsorlist. This command is used to list the contents of a directory or sub-directory so that we can see the contents. It's very similar to thedircommand in Windows. So let's use it in theaircrack-ngdirectory;bt > lsWe can see that Linux listed all the files and directories within theaircrack-ngdirectory. Linux allows us to modify its commands by using switches; these are usually letters preceded by the dash(-). Withls, it's helpful to use two of theses switches,-aand-l.The-aswitch means all, so when we use it, Linux will list all files and directories, even those that are hidden. When we use the-lswitch, it gives us a long listing, meaning it gives us info on the security permissions, the size, the owner, the group of the file or directory, when it was created, etc.Let's type:bt > ls -laWe'll examine more closely the security permissions in a later tutorial, but you must know that you need execute(x)permission on any file you want to execute. So, if you download a new tool, you must make certain that you have execute permission on it.Step 3: Create a File (Touch)The create a file in Linux, it's a bit different from Windows. In Linux, we use thetouchcommand. So, let's create a new file callednewfile:bt > touch newfileNow we can check to see if that file exists by doing a directory listing:bt > ls -laWe can see that new file has been created!Step 4: Create a Directory (Mkdir)Similar to Windows, we can create a directory by using themake directory command(mkdir). Let's now make a new directory.bt > mkdir newdirectoryNow typelsand we can see that a new directory has been created .Step 5: Getting Help (Man)Linux has a very useful utility calledman.Manis the manual for nearly every command. If you should forget what a command does, simply typemanand the name of the command and it will display the manual with all the info you need about that command, its switches, and arguments. For instance, type:bt > man touchWith most commands, you can also use either the-hswitch or the--helpswitch after the command to obtain "help" about a particular command. In the case of "touch", we must use the--helpto obtain help on thetouchcommand.bt > touch --helpAnd that's it for this brief tutorial on Linux for aspiring hackers. Make sure to check outthe first partif you haven't already.I'll be going more into depth in my next tutorial, so keep coming back!Penguin photoby mdidWant to start making money as a white hat hacker?Jump-start your hacking career with our2020 Premium Ethical Hacking Certification Training Bundlefrom the newNull Byte Shopand get over 60 hours of training from cybersecurity professionals.Buy Now (90% off) >Other worthwhile deals to check out:97% off The Ultimate 2021 White Hat Hacker Certification Bundle99% off The 2021 All-in-One Data Scientist Mega Bundle98% off The 2021 Premium Learn To Code Certification Bundle62% off MindMaster Mind Mapping Software: Perpetual LicenseRelatedHack Like a Pro:Linux Basics for the Aspiring Hacker, Part 1 (Getting Started)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 21 (GRUB Bootloader)News:How to Study for the White Hat Hacker Associate Certification (CWA)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 4 (Finding Files)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 13 (Mounting Drives & Devices)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 11 (Apache Web Servers)Hack Like a Pro:Windows CMD Remote Commands for the Aspiring Hacker, Part 1Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 9 (Managing Environmental Variables)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 3 (Managing Directories & Files)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 5 (Installing New Software)How To:Simplify Payload Creation with MSFPC (MSFvenom Payload Creator)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 16 (Stdin, Stdout, & Stderror)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 22 (Samba)How To:The Essential Skills to Becoming a Master HackerHack Like a Pro:Linux Basics for the Aspiring Hacker, Part 19 (Linking Files)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 6 (Networking Basics)How To:Linux Basics for the Aspiring Hacker: Using Start-Up ScriptsHack Like a Pro:Linux Basics for the Aspiring Hacker, Part 12 (Loadable Kernel Modules)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 20 (Devices Files)How To:Linux Basics for the Aspiring Hacker: Configuring ApacheHack Like a Pro:Linux Basics for the Aspiring Hacker, Part 17 (Client DNS)Hack Like a Pro:Linux Basics for the Aspiring Hacker, Part 7 (Managing Permissions)How To:Hack a Site Knowing a Bit of HTML (hackthissite.org) Part 3Goodnight Byte:HackThisSite Walkthrough, Part 6 - Legal Hacker TrainingGoodnight Byte:HackThisSite Walkthrough, Part 8 - Legal Hacker TrainingGoodnight Byte:HackThisSite Walkthrough, Part 10 - Legal Hacker TrainingNews:First Steps of Compiling a Program in LinuxGoodnight Byte:HackThisSite Walkthrough, Part 7 - Legal HackerCommunity Byte:HackThisSite Walkthrough, Part 10 - Legal Hacker TrainingCommunity Byte:HackThisSite Walkthrough, Part 8 - Legal Hacker TrainingHow To:Recover Deleted Files in LinuxCommunity Byte:HackThisSite Walkthrough, Part 6 - Legal Hacker TrainingHow To:How Hackers Take Your Encrypted Passwords & Crack ThemHow To:Hack Wireless Router Passwords & Networks Using HydraHow To:Use Cygwin to Run Linux Apps on WindowsCommunity Byte:HackThisSite Walkthrough, Part 9 - Legal Hacker TrainingHow To:Customize Your Linux DesktopHow To:Install "Incompatible" Firefox Add-Ons After Upgrading to the New FirefoxHack Like a Pro:Hacking Samba on Ubuntu and Installing the MeterpreterCommunity Byte:HackThisSite Walkthrough, Part 1 - Legal Hacker Training