diff: To find the differences between two files, usedifffollowed by the file names. For example,diff file1.txt file2.txtwill display the lines that differ between “file1.txt” and “file2.txt”.cmp: Usecmpfollowed 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. Usecommfollowed by the file names. For example,comm file1.txt file2.txt.sort: To sort the content of a file, usesortfollowed by the file name. It will display the sorted output. For example,sort myfile.txt.export: To set environment variables, useexportfollowed by the variable name and value. For example,export MY_VAR="Hello".zip: Usezipfollowed 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, useunzipfollowed by the archive name. For example,unzip archive.zip.ssh: Usesshfollowed 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, useservicefollowed by the service name and the action (start, stop, restart, etc.). For example,service apache2 startwill start the Apache service.ps: Usepsto display active processes. The commandps auxshows a detailed list of all processes running on the system.killandkillall: To terminate a process, usekillfollowed 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: Typingdfdisplays disk usage and filesystem information.mount: Usemountto 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, usechmodfollowed 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: Usechownfollowed 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: Typingifconfigdisplays network interfaces and their associated IP addresses.traceroute: Usetraceroutefollowed 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, usewgetfollowed 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 withsudo. For example,sudo apt-get updatewill update the package list using elevated privileges.cal: Typingcalwill display a command-line calendar for the current month.alias: To create custom shortcuts for regularly used commands, usealiasfollowed 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 commandls -l.dd:ddis used for low-level copying and conversion of data. To create a bootable USB stick, you can useddto 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: Usewhereisfollowed 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, usewhatisfollowed by the command name. For example,whatis lswill provide a short description of the “ls” command.top: Typingtopdisplays a live view of active processes, system usage, and resource statistics.useraddandusermod: To add a new user, useuseraddfollowed 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, usepasswdfollowed 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