Some Ubuntu Command
1.ls: Lists files and directories in the current directory.
Example: ls -l lists files and directories in long format.
2.cd: Changes the current directory.
Example: cd Documents changes to the "Documents" directory.
3.pwd: Prints the current working directory.
Example: pwd displays the full path of the current directory.
4.mkdir: Creates a new directory.
Example: mkdir my_folder creates a directory named "my_folder".
5.rm: Removes files and directories.
Example: rm file.txt deletes a file named "file.txt".
Example: rm -r my_folder deletes a directory and its contents recursively.
6.cp: Copies files and directories.
Example: cp file.txt new_location/file.txt copies "file.txt" to a new location.
7.mv: Moves or renames files and directories.
Example: mv file.txt new_location/file.txt moves "file.txt" to a new location.
Example: mv file.txt new_name.txt renames "file.txt" to "new_name.txt".
8.cat: Displays the content of a file.
Example: cat file.txt shows the contents of "file.txt".
9.grep: Searches for a pattern in files.
Example: grep "hello" file.txt searches for the word "hello" in "file.txt".
10.chmod: Changes the permissions of files and directories.
Example: chmod 755 script.sh sets read, write, and execute permissions for the owner, and read and execute permissions for others on "script.sh".
11.sudo: Executes a command with superuser (root) privileges.
Example: sudo apt update updates the package lists using root privileges.
12.apt: Package management command for Ubuntu and Debian-based systems.
Example: apt install package_name installs a package.
Example: apt remove package_name removes a package.
Example: apt update updates the package lists.
13.apt-get: Another package management command for Ubuntu and Debian-based systems. It performs similar tasks to apt.
Example: apt-get install package_name installs a package.
Example: apt-get remove package_name removes a package.
Example: apt-get update updates the package lists.
14.dpkg: Low-level package management command used to install, remove, and manage Debian packages.
Example: dpkg -i package.deb installs a package from a .deb file.
Example: dpkg -r package_name removes a package.
Example: dpkg -l lists installed packages.
15.wget: Command-line tool for downloading files from the web.
Example: wget https://example.com/file.txt downloads "file.txt" from the specified URL.
16.tar: Command for creating, compressing, and extracting files from tar archives.
Example: tar -cvf archive.tar files creates a new tar archive from the specified files.
Example: tar -xvf archive.tar extracts files from a tar archive.
Example: tar -czvf archive.tar.gz files creates a compressed tar archive (gzip).
17.ssh: Connects to a remote machine securely using the SSH protocol.
Example: ssh username@remote_host establishes an SSH connection to the specified remote host.
18.top: Displays real-time system information, including CPU usage, memory usage, and running processes.
Example: top shows a dynamic overview of system resource usage.
19.htop: Interactive process viewer that provides an enhanced alternative to the top command.
Example: htop displays an interactive process monitoring interface.
20.find: Searches for files and directories based on various criteria.
Example: find /path/to/search -name "*.txt" searches for all files with the .txt extension in the specified path.
21.df: Displays disk space usage for file systems.
Example: df -h shows disk space usage in a human-readable format.
22.du: Estimates file and directory space usage.
Example: du -sh directory displays the total size of the specified directory.
23.ping: Tests network connectivity to a specific host or IP address by sending ICMP echo request packets.
Example: ping google.com pings the Google website to check network connectivity.
24.ifconfig: Displays information about network interfaces, including IP addresses and network configuration.
Example: ifconfig shows the network interface configuration.
25.ip: A powerful command for configuring and managing network interfaces, routes, and other networking-related tasks.
Example: ip addr show displays IP addresses assigned to network interfaces.
26.netstat: Displays network connections, routing tables, and network statistics.
Example: netstat -tuln shows all listening TCP and UDP connections.
27.systemctl: Command for controlling the systemd system and service manager.
Example: systemctl start service_name starts a system service.
Example: systemctl stop service_name stops a system service.
Example: systemctl restart service_name restarts a system service.
28.journalctl: Views and manages logs generated by systemd.
Example: journalctl -u service_name displays logs for a specific service.
Example: journalctl -f shows real-time log updates.
29.history: Displays a list of previously executed commands.
Example: history shows a list of recently executed commands.
30.chmod: Changes the permissions of files and directories.
Example: chmod +x script.sh grants execute permission to the "script.sh" file.
31.chown: Changes the ownership of files and directories.
Example: chown user:group file.txt changes the owner and group of "file.txt".
32.useradd: Adds a new user to the system.
Example: useradd username creates a new user account.
33.passwd: Sets or changes the password for a user account.
Example: passwd username allows you to set or change the password for the specified user.
34.su: Switches the current user to another user account.
Example: su username switches to the user account specified by "username".
These are just a few more Ubuntu commands that can be handy in various scenarios. Remember to use the appropriate command based on your specific requirements and refer to the respective command's documentation for more details on available options and usage.
35.adduser: Similar to useradd, this command adds a new user to the system with additional configuration options and prompts.
Example: adduser username creates a new user account with interactive prompts for additional information.
36.userdel: Deletes a user account from the system.
Example: userdel username removes the specified user account from the system.
37.passwd: Changes the password for a user account.
Example: passwd username allows you to change the password for the specified user.
38.sudoers: Manages the sudo configuration file, which controls user privileges and permissions.
Example: sudo visudo opens the sudoers file in the default text editor for modification.
39.apt-cache: Displays information about packages in the local package cache.
Example: apt-cache search package_name searches for packages matching the specified name or keyword.
40.dpkg-reconfigure: Reconfigures an installed package, allowing you to modify its configuration settings.
Example: dpkg-reconfigure package_name prompts you to reconfigure the specified package.
41.shutdown: Shuts down the system.
Example: shutdown now initiates an immediate system shutdown.
Example: shutdown -r 10 schedules a system reboot in 10 minutes.
42.reboot: Reboots the system.
Example: reboot initiates a system reboot.
43.aptitude: A higher-level package management command with a text-based interface, providing more advanced package management capabilities.
Example: aptitude search package_name searches for packages matching the specified name or keyword.
44.free: Displays information about system memory usage.
Example: free -h shows memory usage in a human-readable format.
45.uname: Prints system information about the kernel and operating system.
Example: uname -a displays detailed information about the system kernel and OS.
46.crontab: Manages cron jobs, which are scheduled tasks that run at specific times or intervals.
Example: crontab -e opens the crontab file in the default text editor for editing.
Example: crontab -l lists the current user's cron jobs.
47.ssh-keygen: Generates SSH key pairs for secure authentication.
Example: ssh-keygen -t rsa generates an RSA key pair for SSH authentication.
48.scp: Securely copies files between local and remote hosts using SSH.
Example: scp file.txt username@remote_host:/path/to/destination copies "file.txt" to the specified remote host.
49.rsync: Efficiently synchronizes files and directories between local and remote locations.
Example: rsync -avz source_directory/ username@remote_host:/path/to/destination synchronizes the contents of the source directory to the remote host.
50.ufw: Uncomplicated Firewall (UFW) is a command-line tool for managing firewall rules on Ubuntu.
Example: ufw enable enables the firewall and starts blocking incoming connections.
Example: ufw allow 80 allows incoming connections on port 80.
51.history: Displays a list of previously executed commands.
Example: history shows a list of recently executed commands.
52.dpkg-query: Queries the package manager database for information about installed packages.
Example: dpkg-query -l package_name checks if a specific package is installed.
53.nc: Netcat is a versatile networking utility for reading from and writing to network connections.
Example: nc -l 8080 listens on port 8080 for incoming network connections.
Example: echo "Hello" | nc remote_host 1234 sends the string "Hello" to the specified remote host and port.
54.blkid: Displays information about block devices, such as UUID and file system type.
Example: blkid lists information about all available block devices.
55.dd: Copies data from one location to another, with the ability to specify block sizes.
Example: dd if=/dev/zero of=file.txt bs=1M count=100 creates a file called "file.txt" filled with zeroes, with a size of 100MB.
56.wget: Command-line tool for downloading files from the web.
Example: wget https://example.com/file.txt downloads "file.txt" from the specified URL.
57.curl: Command-line tool for transferring data to or from a server.
Example: curl https://example.com retrieves the content of a webpage and displays it in the terminal.
58.screen: Creates multiple terminal sessions within a single SSH session or local session.
Example: screen starts a new screen session.
Example: screen -r reattaches to a detached screen session.
59.jobs: Lists the running jobs in the current shell session.
Example: jobs displays a list of currently running jobs.
60.bg: Puts a suspended job into the background, allowing it to continue running.
Example: bg %1 resumes job number 1 in the background.
61.fg: Brings a background job to the foreground, allowing interaction with it.
Example: fg %1 brings job number 1 to the foreground.
62.nohup: Runs a command that continues executing even after the user logs out or the terminal is closed.
Example: nohup command & runs "command" in the background and keeps it running after the terminal is closed.
63.kill: Terminates a process by sending it a signal.
Example: kill process_id terminates the process with the specified process ID.
64.ps: Lists the currently running processes.
Example: ps aux displays a detailed list of all running processes.
65.df: Displays disk space usage for file systems.
Example: df -h shows disk space usage in a human-readable format.
66.du: Estimates file and directory space usage.
Example: du -sh directory displays the total size of the specified directory.
67.ln: Creates a link to a file or directory.
Example: ln -s /path/to/file link creates a symbolic link named "link" pointing to the specified file.
68.sshfs: Mounts a remote directory over SSH to a local directory.
Example: sshfs user@host:/remote/directory /local/mountpoint mounts the remote directory to the local mount point.
69.lsof: Lists open files and the processes that have them open.
Example: lsof /path/to/file shows which processes have the specified file open.
70.which: Locates the executable file associated with a command.
Example: which command displays the path of the executable file for the specified command.
71.whereis: Locates the binary, source code, and manual page files for a command.
Example: whereis command shows the location of the command's binary, source code, and manual page files.
72.tar: Command for creating, compressing, and extracting files from tar archives.
Example: tar -cvf archive.tar files creates a new tar archive from the specified files.
Example: tar -xvf archive.tar extracts files from a tar archive.
73.zip: Command for creating, compressing, and extracting zip archives.
Example: zip archive.zip files creates a new zip archive from the specified files.
Example: unzip archive.zip extracts files from a zip archive.
74.scp: Securely copies files between local and remote hosts using SSH.
Example: scp file.txt username@remote_host:/path/to/destination copies "file.txt" to the specified remote host.
75.rsync: Efficiently synchronizes files and directories between local and remote locations.
Example: rsync -avz source_directory/ username@remote_host:/path/to/destination synchronizes the contents of the source directory to the remote host.
76.nc: Netcat is a versatile networking utility for reading from and writing to network connections.
Example: nc -l 8080 listens on port 8080 for incoming network connections.
Example: echo "Hello" | nc remote_host 1234 sends the string "Hello" to the specified remote host and port.
77.scp: Securely copies files between local and remote hosts using SSH.
Example: scp file.txt username@remote_host:/path/to/destination copies "file.txt" to the specified remote host.
78.chroot: Changes the root directory for the current running process and its children.
Example: chroot /new/root /bin/bash starts a new shell with the root directory set to /new/root.
79.history: Displays a list of previously executed commands.
Example: history shows a list of recently executed commands.
80.alias: Creates a custom command or sets an alias for an existing command.
Example: alias c=clear sets the alias "c" to execute the "clear" command.
81.find: Searches for files and directories based on specified criteria.
Example: find /path/to/search -name "*.txt" searches for all files with a .txt extension in the specified directory and its subdirectories.
82.grep: Searches for patterns in files or input.
Example: grep "pattern" file.txt searches for the specified pattern in the content of the file.
83.sed: Stream editor for performing text transformations.
Example: sed 's/foo/bar/g' file.txt replaces all occurrences of "foo" with "bar" in the file.
84.awk: A versatile text processing tool for extracting and manipulating data.
Example: awk '{print $1}' file.txt prints the first column of the file.
85.cut: Extracts specific columns or sections from a file.
Example: cut -d ',' -f 2,4 file.csv extracts the second and fourth columns from a CSV file delimited by commas.
86.head: Outputs the first few lines of a file.
Example: head -n 10 file.txt displays the first 10 lines of the file.
87.tail: Outputs the last few lines of a file.
Example: tail -n 5 file.txt displays the last 5 lines of the file.
88.tee: Reads from standard input and writes to standard output and files simultaneously.
Example: command | tee file.txt redirects the output of a command to both the file and the console.
89.sort: Sorts lines of text files alphabetically or numerically.
Example: sort file.txt sorts the contents of the file in ascending order.
90.uniq: Filters adjacent duplicate lines from sorted input.
Example: uniq file.txt removes consecutive duplicate lines from the file.
91.wc: Counts the number of lines, words, and characters in a file or input.
Example: wc -l file.txt displays the number of lines in the file.
92.tailf: Outputs the last few lines of a file and continues to display new lines as they are added.
Example: tailf file.txt shows the last few lines of the file and actively monitors for new additions.
93.apt-get: Command-line package manager for Ubuntu to install, upgrade, or remove software packages.
Example: apt-get update updates the local package index.
Example: apt-get install package_name installs the specified package.
These commands provide additional functionality and can be helpful for various tasks in Ubuntu. Remember to refer to the respective command's documentation or use the man command followed by the command name for more details on their usage and available options.
94.journalctl: Views system logs using the systemd journal.
Example: journalctl -u service_name displays the logs for a specific systemd service.
95.uptime: Shows how long the system has been running and the current system load.
Example: uptime displays the system uptime and load average.
96.chown: Changes the ownership of a file or directory.
Example: chown username file.txt changes the ownership of "file.txt" to the specified user.
97.chmod: Changes the permissions of a file or directory.
Example: chmod +x script.sh grants execute permission to the script file.
98.ln: Creates a link to a file or directory.
Example: ln -s /path/to/file link creates a symbolic link named "link" pointing to the specified file.
99.host: Performs DNS lookups to translate domain names to IP addresses and vice versa.
Example: host example.com retrieves the IP address associated with the domain name.
100.traceroute: Traces the route that packets take to reach a destination host.
Example: traceroute example.com shows the network path taken by packets to reach the specified host.
101.screenfetch: Displays system information and ASCII art of the Linux distribution.
Example: screenfetch shows system information and a logo representing the Linux distribution.
102.htop: Interactive process viewer and system monitoring tool.
Example: htop launches the interactive htop process viewer.
103.ifconfig: Displays and configures network interfaces (deprecated in newer Ubuntu versions, replaced by ip command).
Example: ifconfig eth0 displays the information for the Ethernet interface eth0.
104.nmcli: Command-line tool for managing NetworkManager, used to control network settings.
Example: nmcli connection show lists the available network connections.
105.ufw: Uncomplicated Firewall (UFW) is a command-line tool for managing firewall rules on Ubuntu.
Example: ufw enable enables the firewall and starts blocking incoming connections.
Example: ufw allow 80 allows incoming connections on port 80.
No comments