File and Directory Operations Commands

File and directory operations are fundamental in working with the Linux operating system. Here are some commonly used File and Directory Operations commands:

Command

Description

Options

Examples

ls List files and directories.
  • -l: Long format listing.
  • -a: Include hidden files hidden ones
  • -h: Human-readable file sizes.
  • ls -l 
    displays files and directories with detailed information.
  • ls -a 
    shows all files and directories, including
  • ls -lh 
    displays file sizes in a human-readable format.
cd Change directory.  
  • cd /path/to/directory
    changes the current directory to the specified path.
pwd Print current working directory.  
  • pwd 
    displays the current working directory.
mkdir Create a new directory.  
  • mkdir my_directory
    creates a new directory named “my_directory”.
rm Remove files and directories.
  • -r: Remove directories recursively.
  • -f: Force removal without confirmation.
  • rm file.txt
    deletes the file named “file.txt”.
  • rm -r my_directory
    deletes the directory “my_directory” and its contents.
  • rm -f file.txt
    forcefully deletes the file “file.txt” without confirmation.
cp Copy files and directories.
  • -r: Copy directories recursively.
  • cp -r directory destination 
    copies the directory “directory” and its contents to the specified destination.
  • cp file.txt destination 
    copies the file “file.txt” to the specified destination.
mv Move/rename files and directories.  
  • mv file.txt new_name.txt 
    renames the file “file.txt” to “new_name.txt”.
  • mv file.txt directory 
    moves the file “file.txt” to the specified directory.
touch Create an empty file or update file timestamps.  
  • touch file.txt 
    creates an empty file named “file.txt”.
cat View the contents of a file.  
  • cat file.txt 
    displays the contents of the file “file.txt”.
head  Display the first few lines of a file.
  • -n: Specify the number of lines to display.
  • head file.txt 
    shows the first 10 lines of the file “file.txt”.
  •  head -n 5 file.txt 
    displays the first 5 lines of the file “file.txt”.
tail Display the last few lines of a file.
  • -n: Specify the number of lines to display.
  • tail file.txt 
    shows the last 10 lines of the file “file.txt”.
  • tail -n 5 file.txt 
    displays the last 5 lines of the file “file.txt”.
ln Create links between files.
  • -s: Create symbolic (soft) links.
  • ln -s source_file link_name 
    creates a symbolic link named “link_name” pointing to “source_file”.
find Search for files and directories.
  • -name: Search by filename.
  • -type: Search by file type.
  • find /path/to/search -name “*.txt” 
    searches for all files with the extension “.txt” in the specified directory.

Linux Commands Cheat Sheet

Linux, often associated with being a complex operating system primarily used by developers, may not necessarily fit that description entirely. While it can initially appear challenging for beginners, once you immerse yourself in the Linux world, you may find it difficult to return to your previous Windows systems. The power of Linux commands in controlling your PC, coupled with their clean user interface, can make it hard to switch back to older operating systems. If you’re a developer, you can likely relate to the advantages and appeal of Linux.

To support developers and beginners alike, we have created a comprehensive Linux/Unix command line cheat sheet. This cheat sheet covers all the basic and advanced commands, including file and directory commands, file permission commands, file compression and archiving, process management, system information, networking, and more with proper examples and descriptions. In addition to that we provide all the most used Linux Shortcut which includes Bash shortcuts, Nano shortcuts, VI & Vim Shortcuts Commands. It provides a solid foundation on Linux OS commands, as well as insights into practical applications.

By the end of this cheat sheet, you will have a basic understanding of Linux/Unix Commands and how it makes development easy for developers.

Linux Commands Cheat Sheet

What is Linux?

Linux is an open-source UNIX-like operating system (OS). An operating system is a software that directly manages a system’s hardware and resources, like CPU, memory, and storage. OS acts as a GUI through which user can communicate with the computer. The OS sits between applications and hardware and makes the connections between all of your software and the physical resources that do the work.

Linux Commands List – Table of Content

  • File and Directory Operations Commands
  • File Permission Commands
  • File Compression and Archiving Commands
  • Process Management Commands
  • System Information Commands
  • Networking Commands
  • IO Redirection Commands
  • Environment Variable Commands
  • User Management Commands
  • Shortcuts Commands List
    • Bash Shortcuts Commands
    • Nano Shortcuts Commands
    • VI Shortcuts Commands
    • Vim Shortcuts Commands
  • FAQs on Linux Commands Cheat Sheet

Similar Reads

Basic Linux Commands with Examples

...

1. File and Directory Operations Commands

In this Linux cheat sheet, we will cover all the most important Linux commands, from the basics to the advanced. We will also provide some tips on how to practice and learn Linux commands. This cheat sheet is useful for Beginners and Experience professionals....

2. File Permission Commands

File and directory operations are fundamental in working with the Linux operating system. Here are some commonly used File and Directory Operations commands:...

3. File Compression and Archiving Commands

File permissions on Linux and Unix systems control access to files and directories. There are three basic permissions: read, write, and execute. Each permission can be granted or denied to three different categories of users: the owner of the file, the members of the file’s group, and everyone else....

4. Process Management Commands

Here are some file compression and archiving commands in Linux:...

5. System Information Commands

In Linux, process management commands allow you to monitor and control running processes on the system. Here are some commonly used process management commands:...

6. Networking Commands

In Linux, there are several commands available to gather system information. Here are some commonly used system information commands:...

7. IO Redirection Commands

In Linux, there are several networking commands available to manage and troubleshoot network connections. Here are some commonly used networking commands:...

8. Environment Variable Commands

In Linux, IO (Input/Output) redirection commands are used to redirect the standard input, output, and error streams of commands and processes. Here are some commonly used IO redirection commands:...

9. User Management Commands

In Linux, environment variables are used to store configuration settings, system information, and other variables that can be accessed by processes and shell scripts. Here are some commonly used environment variable commands:...

10. Shortcuts Commands

In Linux, user management commands allow you to create, modify, and manage user accounts on the system. Here are some commonly used user management commands:...

Conclusion

There are many shortcuts commands in Linux that can help you be more productive. Here are a few of the most common ones:...

FAQs on Linux Commands Cheat Sheet

In conclusion, Linux is a widely used operating system for development, and as a developer, you should have knowledge of Linux and its basic commands. In this Cheat Sheet, we covered all commands like creating directories, file compression and archiving, process management, system information, networking and more. In addition to that, this Linux Cheat Sheet is organized and categorized, making it easy for developers to quickly find the commands they need for specific use cases. By utilizing this resource, developers can enhance their productivity and efficiency in working with Linux, leading to smoother and more successful development projects....