Linux Command Line Tutorial for Beginners

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!

1. Navigating the Command Line

1.1. Use the pwd command to see your current directory.

Use pwd to display the path of your current working directory.

1.2. Use ls to list files and directories.

Use ls -la to list all files and directories in detail.

1.3. Use cd to change directories.

1.4. Use mkdir to create a new directory.

mkdir my_new_folder creates a new directory.

1.5. Use touch to create a new file.

touch my_new_file.txt creates a new empty file.

2. File Operations

2.1. Use cp to copy a file.

cp my_new_file.txt my_new_file_copy.txt copies the file.

2.2. Use mv to move or rename a file.

mv my_new_file_copy.txt my_new_file_moved.txt moves or renames the file.

2.3. Use rm to remove a file.

rm my_new_file_moved.txt deletes the file.

2.4. Use rm -r to remove a directory and its contents.

rm -r test_dir deletes a directory and all its contents.

3. More Useful Commands

3.1. Use cat to view the contents of a file.

cat test_file.txt displays the contents of a file.

3.2. Use grep to search for text in a file.

grep 'test' test_file.txt searches for the word "test" in a file.

3.3. Use man to view command help.

man ls displays the manual page for the ls command.

3.4. Use clear to clear the terminal screen.

clear clears the terminal screen.

3.5. Use exit to exit the terminal screen.

3.6. Use history to see a history of your commands.

history -c clears your history.

Final Thoughts

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!