Common Command-Line Examples The command line is a powerful tool. It lets you talk directly to your computer. You type text commands to move files, find data, and control programs. Here are the most common commands you will use every day. Navigation Commands These commands help you move around your computer folders. pwd prints your current folder location. ls lists all files in your current folder. cd Documents moves you into the Documents folder. cd .. moves you up one folder level. File and Folder Management Use these commands to create, copy, and delete items. mkdir NewFolder creates a brand new folder. touch notes.txt creates a new, empty text file. cp photo.jpg backup/ copies a file to a new place. mv notes.txt Documents/ moves a file to a folder. mv old.txt new.txt renames a file. rm extra.txt deletes a file forever. rm -r OldFolder deletes a folder and everything inside. Viewing and Searching Files
These commands let you look inside files and search for words. cat story.txt shows the entire text file on screen. head -n 5 log.txt shows the first five lines. tail -n 5 log.txt shows the last five lines.
grep “error” server.log finds the word “error” inside a file. System Information Check on your computer’s health and tasks with these tools. top shows running programs and memory use. df -h shows how much free hard drive space remains. clear cleans the screen of old text. If you want to customize this list, tell me your goal:
Operating system (Windows Command Prompt, Mac Terminal, or Linux) Skill level (Beginner, Intermediate, or Advanced)
Specific tasks (Network troubleshooting, programming setup, or file automation) Saved time Comprehensive Inappropriate Not working
A copy of this chat, including the images and video, will be included with your feedback A copy of this chat will be included with your feedback
Your feedback will include a copy of this chat and the image from your search
Your feedback will include a copy of this chat, any links you shared, and the image from your search.
Thanks for letting us know
Google may use account and system data to understand your feedback and improve our services, subject to our Privacy Policy and Terms of Service. For legal issues, make a legal removal request.