Author Topic: 60 essential Linux commands 3/3  (Read 1701 times)

Offline javajolt

  • Administrator
  • Hero Member
  • *****
  • Posts: 35867
  • Gender: Male
  • I Do Windows
    • windows10newsinfo.com
    • Email
60 essential Linux commands 3/3
« on: July 23, 2025, 03:53:24 AM »


41. jobs command

Jobs are tasks or commands that are running in your current shell. To check them, use the jobs command with the following syntax:

Quote
jobs [options] [Job_ID]

Running this command without any argument will show all jobs running in the Terminal’s foreground and background. If you don’t have any ongoing tasks, it will return an empty output.

You can display more detailed information about each job by adding the -l option. Meanwhile, use -n to show only tasks whose status has changed since the last notification.

42. ki:ll command

Use the kill command to terminate a process using its ID. Here’s the basic syntax:

Quote
kill [signal_option] Process_ID

To obtain the process ID, run the following command:

Quote
ps ux

The kill command has 64 termination signals. By default, it uses the SIGTERM method that lets the program save its progress before closing.

43. shutdown command

The shutdown command lets you turn off or restart your Linux system at a specific time. Here’s the syntax:

Quote
shutdown [option] [time] [message]

If you run the command without any arguments, your system will shut down immediately. You can specify the schedule using a 24-hour format or a relative one. For example, enter +5 to shut down the system after five minutes. To restart the machine, add the -r option.

The message argument specifies the notification other users in your system will receive before the server shuts down.

44. ping command

The ping command sends packets to a target server and fetches the responses. It is helpful for network diagnostics. The basic syntax looks like the following:

Quote
ping [option] [hostname_or_IP_address]

By default, ping sends infinite packets until the user manually stops it by pressing Ctrl + C.

However, you can specify a custom number using the -c option. You can also change the interval between transfers by adding -i.

For instance, let’s send 15 packets every two seconds to Google’s server:

Quote
ping -c 15 -i 2 google.com



45. wget command

The wget command lets you download files from the internet via HTTP, http, or FTP protocols. Here’s the syntax:

Quote
wget [options]

By default, the wget command will download an item to your current working directory. For example, run this command to retrieve the latest WordPress installer:

Quote
wget  [url]http://wordpress.org/latest.zip[/url]

46. cURL command]

By default, the wget command will download an item to your current working directory. For example, run this command to retrieve the latest WordPress installer:

Quote
wget  http://wordpress.org/latest.zip

46. cURL command

Use the cURL command to transfer data from or to a server by specifying its URL. The basic syntax looks as follows:

Quote
curl [options] URL

Running cURL without an option will print the website’s HTML content in your Terminal. If you add the -O or -o option, the command will download files from the specified link.

The cURL command is also helpful for testing API or server endpoints. You can do so by adding the –X option followed by an HTTP method, depending on whether you want to fetch or upload data.

For example, the following command will retrieve data from a specific API endpoint:

Quote
curl -X GET http://api.example.com/endpoint

47. scp command

The scp command lets you securely copy files and directories between systems over a network. The syntax looks as follows:

Quote
scp [option] [source username@IP]:/[directory and file name] [destination username@IP]:/[destination directory]

If you are copying items to or from your local machine, omit the IP and path. When transferring a file or folder from a local machine, specify its name after options.

For example, we will run the following to copy file1.txt to our VPS’ path/to/folder directory as root:

Quote
scp file1.txt root@185.185.185.185:path/to/folder

You can change the default SCP port by specifying its number after the -P option. Meanwhile, use the -l flag to limit the transfer bandwidth and add –C to enable compression.

48. rsync command

The rsync command syncs files or folders between two destinations to ensure they have the same content. The syntax looks as follows:

Quote
rsync [options] source destination

The source and destination can be a folder within the same system, a local machine, or a remote server. If you are syncing content with a VPS, specify the username and IP address like so:

Quote
rsync /path/to/local/folder/ vps-user@185.185.185.185:/path/to/remote/folder/

You can add the -a option to sync the file or folder’s attributes as well, including their symbolic links. Meanwhile, use the -z flag to enable compression during the transfer.

49. ip command

The ip utility lets you list and manage your system’s network parameters, similar to the ifconfig command in older Linux distros. Here’s the syntax:

Quote
ip [options] object command

Running this command without any argument will print the manual, including an explanation about acceptable options and objects.

To manage a network parameter, specify the action in the command argument. For example, run this to show your system’s IP address:

Quote
ip address show





50. netstat command

The netstat command displays information about your system’s network configuration. The syntax is simple:

Quote
netstat [options]

Add an option to query specific network information. Here are several flags to use:

   • -a – displays listening and closed sockets.

   • -t – shows TCP connections.

   • -u – lists UDP connections.

   • -r – displays routing tables.

   • -i – shows information about network interfaces.

   • -c – continuously outputs network information for real-time monitoring.

51. traceroute command

The traceroute command tracks a packet’s path when traveling between hosts, providing information like the transfer time and involved routers. Here’s the syntax:

Quote
traceroute [options] destination

You can use a hostname, domain name, or IP address as the destination. If you don’t specify an option, traceroute will run the test using the default settings.

Change the maximum packet hops using the -m option. To prevent traceroute from resolving IP addresses, add -n.

You can also enable a timeout in seconds using the -w flag followed by the duration.

52. nslookup command

The nslookup command requests a domain name system (DNS) server to check a domain linked to an IP address or vice versa. Here’s the syntax:

Quote
nslookup [options] domain-or-ip [dns-server]

If you don’t specify a DNS server, nslookup will use your internet service provider’s default resolver. You can add other options to change how this command queries an IP address or a domain.

For example, use the -type= option to specify the information you want to check, such as the DNS records.

You can also set up automatic retry with the -retry= flag and add -port= to use a specific port.



Since some Linux distros don’t have this utility pre-installed, you might encounter the “command not found” error. You can configure it by downloading bind-utils or dnsutils via your package manager.

53. dig command

The domain information groper or dig command displays information about a domain. It is similar to nslookup but more comprehensive. The syntax looks as follows:

Quote
dig [options] [server] [type] name-or-ip

Running dig without an argument will check A records of the specified domain using the operating system’s default resolver. You can query a particular record by specifying it in the [type] argument like the following example:

Quote
dig MX domain.com

To run a reverse DNS lookup, add the –x option and use an IP address as the target.

54. history command

Run the history command to check previously run utilities. Here’s its syntax:

Quote
history [options]

Add the -r option if you want to clear the Terminal history. To rerun a specific utility from the list, enter an exclamation mark followed by its ID.

For example, use the following to run the 145th command:

Quote
!145



55. man command

The man or manual command displays a comprehensive guide of another utility. The syntax looks like the following:

Quote
man [options] [section_number] command_name

If you specify only the command name, man will display the entire manual. Alternatively, you can select one of the nine sections using their IDs to print more specific information.

For example, run the following to check the library call section of the ls command’s manual:

Quote
man 3 ls

56. echo command

Use echo to print text in your command as a Terminal output. Here’s the syntax:

Quote
echo [options] [text]

You can also add the redirection symbol (>) to print the text in a file instead of Terminal. If you use two symbols (>>), it will append the existing content. The command syntax looks like this:

Quote
echo [options] [text] > [file_name]

If your text contains an environment or shell variable like $var, echo will display the actual value. This command is commonly used for testing and bash scripting.

57. ln command

The ln command links files or directories with a shortcut. The syntax looks as follows:

Quote
ln [options] source target

This command will automatically create the shortcut, meaning you don’t need to make one manually. For example, the following will enable you to open file.txt using shortcut.txt:

Quote
ln target.txt shortcut.txt

By default, ln creates a hard link, meaning changes in the source will be reflected in the linked item and vice versa. To set up a soft or symbolic link, add the -s option.

58. alias and unalias command

The alias command lets you set another name for a string that belongs to a file, text, program, or command name. Here’s the syntax:

Quote
alias name='string'

For example, the following will assign k as the alias for the kill command, allowing you to use the letter instead of the full name.

Quote
alias k='kill'

To check a command’s alias, run alias followed by an alternative name. For example, we will check the previous snippet:

Quote
alias k



You can remove an alias by running this syntax:

Quote
unalias [name]

59. cal command

The cal command displays a calendar in your Linux command-line interface. Here’s the syntax:

Quote
cal [options] [month] [year]

If you don’t add any argument, the command will show the current date. Alternatively, you can enter a specific month and year in a numerical format.

You can also add the -3 option to show the current, previous, and next month.

60. apt and dnf command

The apt command lets you manage advanced package tool (APT) libraries in Debian-based operating systems such as Ubuntu and Kali Linux. The syntax looks like this:

Quote
apt [options] subcommand

The subcommands define the action, like updating the library, upgrading software, installing an application, or removing a package. For example, we will install the Vim text editor:

Quote
apt install vim

In Linux, package management commands differ across distributions. For example, Red Hat Enterprise Linux-based distros like CentOS and AlmaLinux use dnf. It has the same syntax and options as apt.

Running both apt and dnf requires superuser privileges, which you can only obtain with sudo or via root.

Conclusion

Linux commands enable system administrators to manage their servers more efficiently. They provide capabilities like scripting, variables, and automation that graphical user interfaces need to improve.

In this tutorial, we have explained the 60 most commonly used Linux commands. These will be invaluable for various tasks, including file management, user administration, navigation, and network configuration.

Take advantage of the Kodee AI assistant to use these commands more efficiently. It lets you use simple prompts to write various utilities and scripts according to your task to save time and effort.

source
« Last Edit: July 23, 2025, 05:48:46 AM by javajolt »