In my , I mentioned that I would be learning in public and sharing what I learn online to hold myself accountable and measure my progress. last blog post Well, last month, I learned how to use the Linux command line. Here's some background information: In , I explained that I am currently curating my coding studies with curriculum. TOP encourages students to use a Linux system to learn to code, while those with a windows computer are taught how to access Ubuntu through a . After installing the virtual machine, we then explored how to manipulate the command line. the previous post The Odin Project (TOP) virtual machine Whenever I'm studying or learning something new, my usual practice is to jot down useful and relevant notes in a notebook. However, for this learning-in-public journey, I have chosen to share my notes below ๐ Linux File System Operations Manipulating files and directories To create a new directory, type ๐ . To create intermediate or nested directories, the command will allow you to do so using the flag like this ๐ . mkdir <directoryname> mkdir -p mkdir -p Documents/book/page To create a file, use ๐ . For example, to create a single file, type ๐ and to create multiple files at once. touch <filename(s)> touch novel.txt touch letter.doc index.html script.js style.css To copy a file, use the command citing two arguments; the first argument is the file you want to copy (the source file) while the second argument (or target) is the location you want to copy the source file. For instance, type ๐ . When copying one directory to another, use the flag and specify both the source and target directories' paths. To copy only the of a directory, remember to use the star operator at the end of the source directory path e.g . cp cp letter.doc book.doc -r contents * cp ~/book/* ~/Documents To delete directories, use or and or for empty and non-empty directories respectively. To delete a file, type ๐ e.g., . To confirm that a command is about to be executed, use the flag, for instance, to confirm that a file is about to be overwritten, type ๐ . rmdir <directory name> rm -d <directory name> rm -r <directory name> rm -rf <directory name> rm <filename> rm script.js -i cp -i <originfile> <targetfile> To rename or move a file (or directory), use the command and type ๐ for instance, to rename a file or to move a directory. You can also move a file or directory by first using the and then the commands. Remember to use the flag when copying directories. To move or copy a file to the current directory, specify the path/location of the file followed by (which means the 'current directory') for instance, type ๐ mv mv <oldname> <newname> mv book.doc index.html mv <directoryname> <targetdirectory> cp rm -r . cp ~/book/page.txt . To print the results of a command to the console, add the flag. e.g., . Using this flag can provide useful reporting when writing scripts that will execute many commands for you. -v rm -v book.doc most command-line programs support , which automatically completes a word if there's only one valid match on the system. For example, if the only file starting with the letters 'Pic' is Picture, you could create the command to remove it as follows ๐ where โฅ is the tab key. Note: tab completion rm Picโฅ The program would then complete the filename, yielding . This feature is especially handy with longer filenames (or directories) where tab completion can save a huge amount of typing. rm Picture Navigating Directories and Files To find out where you are on the terminal, use the command. You can also use this to get the path of your home directory. To see if a given program is available at the command line, type ๐ . The command technically locates a file on the userโs [usr] path; which is a list of directories where executable programs are located. pwd which <program name> which To see what files or directories are in your current directories, type . To see both 'visible' and 'hidden' files and directories, use the flag as follows ๐ . To find out the contents of another directory, without first leaving your current directory, specify the full path of the other directory to the command as follows ๐ . To list directories' names only without listing their contents, use the flag, for instance, type ๐ to list all files and directories starting with without listing their contents. ls -a ls -a ls ls /home/username/books -d ls -d txt* txt To list all files and directories of a certain type, for instance; for all files ending in pattern, type ๐ ; for all files starting with , type ๐ ; for all files containing , type ๐ . To find files whose names match a certain pattern or file extension e.g starting in the current directory and in its sub-directories, use the command and type ๐ . txt ls *txt txt ls txt* txt ls *txt* .txt . find find . -name '*.txt' To find out detailed information on files and directories, type ๐ . To see the sizes of files and directories, in a human-readable format such as 1K or 23M, use ๐ . To list the long form of each file or directory in order of how recently it was modified ( so that the most recently modified entries appear at the bottom of the screen for easy inspection), type ๐ . To display the long-form of files sorted, so the largest files appear at the bottom, type ๐ . ls -l ls -lh reversed ls -lrt ls -lrS To navigate to the home directory, type ๐ . To navigate back up a directory (i.e., to move one level up to the parent directory of the current directory), type ๐ To move change directories to the directory, wherever that was, type ๐ . To move to an immediate sub-directory, type ๐ e.g . To change directories, call the command by specifying to it the full path of the directory you want to navigate to, e.g., . cd cd .. previous cd - cd <directory> cd Documents cd cd ~/book To redirect the output of one command to the input of another command, use the pipe operator . For instance, to interactively navigate the full output of a command like in your terminal window, pipe the output to as follows ๐ . | git help less git help | less To combine commands, use the semicolon or double-ampersand characters after each command you want to combine, e.g., to create a file in another directory without leaving your current directory, type ๐ . The difference between these two characters is that commands separated by run only if the previous command succeeded while with all the commands will be run no matter what. ; && cd <directory> && touch <filename> && cd - && ; ๐ ๐ Hey, thanks for reading! Also published on . https://theconsistentdeveloper.hashnode.dev/an-introduction-to-the-linux-command-line-for-beginners