Welcome to the Linux Command Line Tutorial! This guide will teach you the basics of navigating the command line, copying, moving, and removing files. Let's get started!
pwd command to see your current directory.Use pwd to display the path of your current working directory.
ls to list files and directories.Use ls -la to list all files and directories in detail.
cd to change directories.cd ~ – Go to your home directory.cd /home/$(whoami) – Go to your user's home directory.cd .. – Move up one directory.cd - – Move back one directory.cd / – Move to root directory.mkdir to create a new directory.mkdir my_new_folder creates a new directory.
touch to create a new file.touch my_new_file.txt creates a new empty file.
cp to copy a file.cp my_new_file.txt my_new_file_copy.txt copies the file.
mv to move or rename a file.mv my_new_file_copy.txt my_new_file_moved.txt moves or renames the file.
rm to remove a file.rm my_new_file_moved.txt deletes the file.
rm -r to remove a directory and its contents.rm -r test_dir deletes a directory and all its contents.
cat to view the contents of a file.cat test_file.txt displays the contents of a file.
grep to search for text in a file.grep 'test' test_file.txt searches for the word "test" in a file.
man to view command help.man ls displays the manual page for the ls command.
clear to clear the terminal screen.clear clears the terminal screen.
exit to exit the terminal screen.history to see a history of your commands.history -c clears your history.
You're now ready to explore the Linux command line! Remember: Practice makes perfect. Try out these commands in your terminal and keep learning. Happy coding!