- diff: To find the differences between two files, use- difffollowed by the file names. For example,- diff file1.txt file2.txtwill display the lines that differ between “file1.txt” and “file2.txt”.
- cmp: Use- cmpfollowed by the two file names to check if two files are identical. If there is no output, it means the files are the same. For example,- cmp file1.txt file2.txt.
- comm:- commcompares two sorted files line by line and displays lines that are common or unique between the files. Use- commfollowed by the file names. For example,- comm file1.txt file2.txt.
- sort: To sort the content of a file, use- sortfollowed by the file name. It will display the sorted output. For example,- sort myfile.txt.
- export: To set environment variables, use- exportfollowed by the variable name and value. For example,- export MY_VAR="Hello".
- zip: Use- zipfollowed by the archive name and the files/directories you want to zip. For example,- zip archive.zip file1.txt file2.txtwill create a zip archive containing “file1.txt” and “file2.txt”.
- unzip: To extract files from a zip archive, use- unzipfollowed by the archive name. For example,- unzip archive.zip.
- ssh: Use- sshfollowed by the username and the remote host to establish a secure shell connection. For example,- ssh username@remote_host.
- service: To start or stop services in Linux, use- servicefollowed by the service name and the action (start, stop, restart, etc.). For example,- service apache2 startwill start the Apache service.
- ps: Use- psto display active processes. The command- ps auxshows a detailed list of all processes running on the system.
- killand- killall: To terminate a process, use- killfollowed by the process ID (PID). For example,- kill 1234.- killallallows you to terminate processes by name. For example,- killall firefoxwill terminate all Firefox processes.
- df: Typing- dfdisplays disk usage and filesystem information.
- mount: Use- mountto mount file systems in Linux. Provide the device or file system and the mount point. For example,- mount /dev/sdb1 /mntwill mount the device- /dev/sdb1to the- /mntdirectory.
- chmod: To change file permissions, use- chmodfollowed by the desired permission settings and the file/directory. For example,- chmod 755 myfile.txtsets read, write, and execute permissions for the owner, and read and execute permissions for group and others.
- chown: Use- chownfollowed by the new owner and the file/directory to change ownership. For example,- chown newuser myfile.txtchanges the owner of “myfile.txt” to “newuser”.
- ifconfig: Typing- ifconfigdisplays network interfaces and their associated IP addresses.
- traceroute: Use- traceroutefollowed by the destination IP or domain name to trace the network hops to reach the destination. For example,- traceroute google.comwill show the network path to reach Google’s servers.
- wget: To download files from the internet, use- wgetfollowed by the URL of the file you want to download. For example,- wget https://example.com/file.txtwill download “file.txt” from the given URL.
- ufw:- ufwis the uncomplicated firewall command in Linux. You can use it to manage the firewall rules. For example,- ufw allow 22allows incoming SSH connections on port 22.
- iptables:- iptablesis the base firewall utility that provides more advanced configuration options for the firewall. It allows you to define specific firewall rules and policies.
- apt,- pacman,- yum,- rpm: These are package managers used in different Linux distributions. You can use these commands to install, update, or remove software packages. The usage may vary depending on the specific distribution you are using.
- sudo: To escalate privileges in Linux and execute commands with administrative privileges, prefix the command with- sudo. For example,- sudo apt-get updatewill update the package list using elevated privileges.
- cal: Typing- calwill display a command-line calendar for the current month.
- alias: To create custom shortcuts for regularly used commands, use- aliasfollowed by the desired alias name and the command you want to associate with it. For example,- alias ll='ls -l'creates an alias “ll” for the command- ls -l.
- dd:- ddis used for low-level copying and conversion of data. To create a bootable USB stick, you can use- ddto copy the ISO image to the USB device. For example,- dd if=image.iso of=/dev/sdb bs=4Mwill copy the “image.iso” file to the USB device- /dev/sdb.
- whereis: Use- whereisfollowed by the command name to locate the binary, source code, and manual pages for a command. For example,- whereis lswill display the location of the “ls” command.
- whatis: To find a brief description of what a command is used for, use- whatisfollowed by the command name. For example,- whatis lswill provide a short description of the “ls” command.
- top: Typing- topdisplays a live view of active processes, system usage, and resource statistics.
- useraddand- usermod: To add a new user, use- useraddfollowed by the username. For example,- useradd newusercreates a new user with the username “newuser”.- usermodis used to modify existing user accounts.
- passwd: To create or update passwords for existing users, use- passwdfollowed by the username. For example,- passwd usernamewill prompt you to enter a new password for the specified user.
Second post how to use them
               
              |
              Aug 17, 2024
              
              
                min read