Table of contents
Linux is a free and open-source operating system that is often used on servers, supercomputers, embedded systems, and personal computers. One of the best things about Linux is that it has a powerful command-line interface that makes it easy and flexible to work with the system. While graphical user interfaces are also available in Linux, mastering the command line can help users to perform complex tasks, automate repetitive actions, and troubleshoot issues more effectively. In this blog post, we'll talk about some basic and advanced Linux commands that have to do with the file system, managing memory, and other useful tasks. Whether you are a Linux beginner or an experienced user, this guide can help you improve your productivity and efficiency in the command line.
Basic Commands
Here are some basic commands in Linux:
ls
: Lists the files and directories in the current directory.cd
: Changes the current directory.pwd
: Prints the working directory.mkdir
: Creates a new directory.rmdir
: Removes a directory.touch
: Creates a new file.rm
: Removes a file.cp
: Copies a file.mv
: Moves or renames a file.cat
: Displays the contents of a file.grep
: Searches for a pattern in a file.sudo
: Executes a command as the root user.apt-get
: Installs, updates, or removes software packages.chmod
: Changes the permissions of a file or directory.chown
: Changes the ownership of a file or directory.
File System Commands
Here are some commands related to file system in Linux:
df
: Displays the disk usage and available space on mounted file systems.du
: Displays the disk usage of a file or directory.fdisk
: A partitioning utility that can create, delete, and manipulate disk partitions.mkfs
: Formats a file system on a disk partition.mount
: Mounts a file system to a directory.umount
: Unmounts a file system from a directory.blkid
: Displays the UUID and file system type of all available block devices.find
: Searches for files and directories based on certain criteria such as name, size, or modification time.locate
: Searches for files and directories based on their names.ln
: Creates a hard or symbolic link to a file.tar
: Creates or extracts a compressed archive file.rsync
: Synchronizes the contents of two directories or files across a network.diff
: Compares the contents of two files and displays the differences.grep
: Searches for a pattern in a file or multiple files.awk
: A text processing tool that can extract and manipulate data from files.
Memory Management Commands:
Here are some commands related to memory management system in Linux:
free
: Displays the amount of free and used memory in the system.top
: Displays real-time information about the system's processes and memory usage.ps
: Displays information about the currently running processes.kill
: Sends a signal to terminate a process.nice
: Adjusts the priority of a process to control its resource usage.renice
: Changes the priority of a running process.vmstat
: Displays virtual memory statistics such as page faults and swap usage.swapon
: Activates a swap partition or file.swapoff
: Deactivates a swap partition or file.ulimit
: Sets limits on system resources such as memory usage and file size for user processes.top
: Provides a dynamic real-time view of the processes running in a system, with detailed information about the memory and CPU usage of each process.htop
: A more advanced version of top, which provides additional functionality and an interactive interface.pmap
: Displays the memory map of a process, showing the virtual memory addresses used by each memory-mapped file or shared library.sysctl
: Configures kernel parameters related to memory management, such as swappiness or the size of the page cache.numactl
: Configures NUMA (non-uniform memory access) settings, such as the allocation policy for memory and CPUs.