Sign In
Sign In

Basic Linux Commands

Basic Linux Commands
Hostman Team
Technical writer
Linux
12.07.2024
Reading time: 9 min

Linux is an open-source operating system commonly used in server solutions that require high reliability, fault tolerance, and customization flexibility. To interact with a Linux-based OS, you execute commands in a console terminal, especially when managing remote hosts such as cloud servers.

Cloud tip:

For more stable connection, start deploying with our VPS Server Hosting with pay-as-you-go model to be more efficient and save money!

This guide will cover the most basic terminal commands necessary for working with most known Linux distributions:

  • Debian

  • Ubuntu

  • Alt Linux

  • Kali Linux

This guide uses Ubuntu 22.04, installed on a Hostman cloud server.

Basic Linux commands vary in their purposes but  are most commonly needed for the following tasks:

  • Managing files and directories: creating, deleting, moving, copying, and changing permissions of files and directories.

  • System administration: managing processes, installing, and removing programs.

  • Managing network: managing network connections, checking network status, and configuring network interfaces.

Command Input and Output Streams

Before diving into the commands, it is important to understand a few basic principles of how Linux handles data.

Every process (program) in Linux has three standard data streams:

  • stdin (number 0): input stream.

  • stdout (number 1): output stream.

  • stderr (number 2): error stream.

The most basic are stdin and stdout.

Using standard data streams, Linux allows you to build data processing pipelines. In other words, instead of displaying the application's (launched by a command) result in the console, you can pass the data as input to another application, and so on.

For example, a trivial pipeline might look like this:

ls .. | grep 32

Output:

lib32
libx32

First, we execute the ls command, which displays a list of all system files and folders, and then pass its output to the grep command, which searches for directories whose names contain 32.

Environment, Directories, and File Management

This section covers the basic commands in Linux for navigating directories and managing files.

Current Directory Address (pwd)

To see which directory you are currently in, use:

pwd

For example, if you are in the /root directory, the console will display:

/root

Changing to a Specific Directory (cd)

Instead of specifying absolute paths when executing commands, it may be convenient to manually navigate between directories:

cd /usr

In this example, we have navigated to the system directory /usr. You can verify this by explicitly requesting the current directory:

pwd

Output:

/usr

To return to the root directory, execute the cd command without specifying a path:

cd

Let's navigate to another system directory:

cd /sys/devices

To go up one level, use two dots (..):

cd ..

Now we are in the /sys directory.

Listing Files and Directories in the Current Directory (ls)

To explore the contents of the file system, you can request a list of files and directories in the current directory by using the ls command in Linux.

ls

Output:

bin  games  include  lib  lib32  lib64  libexec  libx32  local  sbin  share  src

To see hidden files and directories, add the -A flag:

ls -A

Output:

.ansible  ._history  .rc  .cache  .lesshst  .profile  resize.log  snap  .ssh

A similar command that provides a bit more information about the file system contents, adding pointers to the current and higher levels, is:

ls -a

Output:

.  ..  .ansible  ._history  .rc  .cache  .lesshst  .profile  resize.log  snap  .ssh

You can check the contents of a directory without navigating into it:

ls /var

The console output will contain a list of files and directories of the specified directory, not the user's current location:

backups  cache  crash  lib  local  lock  log  mail  opt  run  snap  spool  tmp

To request a list of all system files and directories, add a slash (/) or two dots (..):

ls /

Or:

ls ..

Creating a Directory (mkdir)

When creating a directory, specify its name:

mkdir mywork

Verify that the directory was created:

ls

Output will show the new directory among others:

mywork  resize.log  snap

Directories can be created recursively (one inside another) using the -p flag:

mkdir myjob/inner -p

Check for the nested directory:

ls ./myjob

Output:

inner

The -p flag also prevents an error when creating an existing directory. For example, try creating the directory again in the usual way:

mkdir mywork

The console will display an error:

mkdir: cannot create directory 'mywork': File exists

However, with the -p flag, there will be no error:

mkdir mywork -p

Creating a File (nano)

Creating a file and filling it with content is done through the console text editor nano:

sudo nano myfile

The console terminal will switch to text editing mode. After finishing work with the file, press Ctrl + S to save it and Ctrl + X to close it.

The content of the created file be as follows:

My text

Copying a File or Directory (cp)

The cp command in Linux is used for copying files and directories. Copying creates an exact copy of the file or directory to the specified address:

cp myfile myfile2

Check the file system:

ls

Output shows our new file:

myfile  myfile2  myjob  mywork  resize.log  snap

Check its content:

sudo nano myfile2

It is identical to the content of the original file:

My text

Copying directories requires specifying the recursive execution flag -r:

cp mywork mywork2 -r

Check the current directory:

ls

The directory was successfully copied:

myfile  myfile2  myjob  mywork  mywork2  resize.log  snap

Deleting a File or Directory (rm)

Let's delete the previously created file:

rm myfile2

To delete directories, specify the -r flag:

rm mywork2 -r

You can also use a special command to delete a directory:

rmdir mywork2

Moving a File or Directory (mv)

Moving a file is similar to copying it, but the original file is deleted:

mv myfile mywork

The file will be located in the specified directory.

Moving directories is no different from moving files:

mv myjob mywork

Quick File Content Viewing (cat)

Instead of using the nano editor, you can immediately display the content of a file in the console using the Linux cat command:

cat mywork/myfile

The console will display the following:

My text

System and Network Information

Basic commands to display system data.

System Clock (date)

You can request the system date and time through the console terminal:

date

Output:

Sun Jul 07 09:27:16 PM BST 2024

List of Active Users (w)

You can request a list of all users currently logged into the system:

w

The console output will be similar to this:

05:00:30 up 40 min,  1 user,  load average: 0.02, 0.01, 0.00
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    91.206.179.207   04:51    1.00s  0.09s  0.00s w

List of Active Processes (ps)

You can request a list of running processes:

ps

Output:

PID TTY          TIME CMD
11643 pts/1    00:00:00
11671 pts/1    00:00:00 ps

Connecting to a Remote Server via SSH (ssh)

ssh is a frequently used Linux command for managing remote hosts through an SSH connection:

ssh root@91.206.179.207

The command above follows this structure:

ssh USER@IP

Replace USER with the remote user's name and IP with the remote host's IP address. The console terminal will then ask for the root password:

root@91.206.179.207's password:

Downloading Files via URL (wget)

Often, some programs are manually downloaded from remote repositories as regular files:

wget https://github.com/nginx/nginx/archive/refs/tags/release-1.25.4.tar.gz

In this example, we download an archive with the Nginx web server from the official GitHub repository. After that, you can check the current directory's status with the ls command to see that the downloaded archive has appeared.

Extracting Archives (tar)

Next you will need to extract files from the downloaded archive:

tar -xvf release-1.25.4.tar.gz

The flags indicate how to perform the extraction:

  • -x means extracting compressed files from the archive;

  • -v means displaying detailed information about the extraction process in the console;

  • -f means that the passed parameters are archive file names.

After extraction, a new folder with the extracted archive's name will appear in the current directory.

After extraction, you can remove the archive.

rm release-1.25.4.tar.gz

Installing and Removing Packages

Commands for managing Linux packages.

Updating the Repository List

Linux distributions have a standard package manager, apt. It is used by default in Debian and Ubuntu distributions. Typically, before using it, update the list of available repositories:

sudo apt update

It also makes sense to update already installed packages in the system:

sudo apt upgrade

You can also view the list of already installed packages in the system:

sudo apt list --installed

The console will display something like this:

Powershell Hr Xj Iijh Lv

Installing a Package

Packages are installed as follows:

sudo apt install nginx

For example, this way we installed the Nginx web server. Very often, during installation, the package manager asks additional questions, which can be answered with yes or no using the console inputs y and n. To have APT automatically answer yes to all questions during installation, add the -y flag:

sudo apt install nginx -y

Removing a Package

To remove a Linux package:

sudo apt remove nginx

Console Management

Commands for managing the console terminal.

Command History (history)

You can view the history of commands entered in the console terminal:

history

Clearing the Console Terminal (clear)

You can periodically clear the commands entered in the terminal:

clear

This will return the command line to its initial (clean) state.

Command Help (man)

You can always get help on any Linux command:

man ls

The console will display information about the command's structure, its possible flags, and parameters.

You can also obtain a shorter and less extensive version of the manual for as follows:

help

Conclusion

In this guide, we discussed the most frequently used commands in Linux. You can use it as a Linux commands cheat sheet, as these are the most basic commands that any user needs to know when working with Linux.

The official Linux kernel project website provides a complete list of commands and official documentation (including command guides, installation, and configuration guides).

Linux
12.07.2024
Reading time: 9 min

Similar

Linux

Creating Symbolic Links in Linux: A Step-by-Step Tutorial

Symlinks, also known as symbolic links, are like shortcuts in the Linux world. They allow you to create a new name (or link) that points to another file, directory, or any object within the file system. Their primary advantage lies in reducing redundancy by avoiding the need for multiple copies of the same file. When you have a symlink, changes made to the original file reflect across all its symbolic links. This eliminates the hassle of updating numerous copies individually. Additionally, symlinks offer a flexible way to manage access permissions. For instance, different users with directories pointing to subsets of files can limit visibility beyond what standard file system permissions allow. In essence, symlinks are indispensable for efficient file management and organization, streamlining updates and access control in complex systems. Prerequisites To follow this tutorial, you will need: A cloud server, virtual machine or computer running a Linux operating system. On Hostman, you can deploy a server with Ubuntu, CentOS or Debian in under a minute. Creating Symbolic Links with the ln Command The ln command is used to create symbolic links in Linux. Follow these steps: Open a terminal window. Navigate to the directory where you want to create the symbolic link. Use the following command syntax to create a symlink: ln -s /path/to/source /path/to/symlink Replace /path/to/source with the actual path of the file or directory you want to link, and /path/to/symlink with the desired name/location of the symlink. Understanding the ln Command Options The ln command offers various options to customize symlink creation:  -s: Creates a symbolic link.  -f: Overwrites an existing symlink.  -n: Treats symlink targets as normal files. Explore these options based on your linking needs. Creating Symbolic Links to Files To create a symlink to a file, use the ln command with the -s option. Here's an example of how you can create a symbolic link to a file using the ln command. The command below creates a symbolic link named symlink_file in the current directory, pointing to the file /path/to/file: ln -s /path/to/file /path/to/symlink_file Replace /path/to/file with the actual file path and /path/to/symlink_file with the desired symlink name. In this example, the file path is absolute. You can also create a symbolic link with a relative path. However, keep in mind that for the symlink to work correctly, anything accessing it must first set the correct working directory, or the link may appear broken. Creating Symbolic Links to Directories You can use the ln command to create a symbolic link that points to a directory. For instance, the command below creates a symbolic link called symlink_directory in the current directory, which points to the directory /path/to/directory: ln -s /path/to/directory /path/to/symlink_directory This command creates a symbolic link named symlink_directory in your current location, linking it to the /path/to/directory directory. Forcefully overwrite a symbolic link You can use the -f flag with the ln command. For example, if the path in a symlink is incorrect due to a typo or if the target has moved, you can update the link like this: ln -sf /path/to/new-reference-dir symlink_directory Using the -f flag ensures that the old symlink's contents are replaced with the new target. It also automatically removes any conflicting files or symlinks if there's a conflict. If you attempt to create a symlink without the -f flag and the symlink name is already in use, the command will fail. Verifying Symbolic Links You can display the contents of a symlink using the ls -l command in Linux: ls -l symlink_directory The output will show the symlink and its target: symlink_file -> /path/to/reference_file Here, symlink_file is the name of the symlink, and it points to the file /path/to/reference_file. ls -l /path/to/symlink The output will show the symlink and its target. Symbolic Link Best Practices Use descriptive names for symbolic links. Avoid circular links to prevent system confusion. Update symlinks if the target's location changes. Use Cases for Symbolic Links Managing Configuration Files: Linking configuration files across systems. Version Control: Symbolic linking common libraries for development projects. Data Backup: Creating symbolic links to backup directories. Potential Pitfalls and Troubleshooting Permission Issues: Ensure proper permissions for source and symlink. Broken Links: Update symlinks if target files are moved or deleted. Cross-Filesystem Links: Symlinks may not work across different filesystems. Conclusion Symlinks are valuable for streamlining file management and system upkeep. They simplify updates across multiple applications sharing a common file, reducing maintenance complexity. They also offer an alternative to directories like /etc, often requiring root access for file modifications. Developers find symlinks useful for transitioning between local testing files and production versions seamlessly. By following this tutorial, you've mastered the art of creating symbolic links in Linux. Leverage symlinks for efficient file management and customization. By the way, with Hostman, you can run your workloads on efficient NL VPS that support low latency for EU-based users. Check this out, we have plenty of budget VPS hosting options for your projects. Frequently Asked Questions (FAQ) How do you create a symbolic link in Linux?  Use the ln command with the -s flag. The syntax is ln -s [path_to_target] [path_to_link]. For example: ln -s /var/www/html/mysite ~/mysite-shortcut. What is an example of a symlink?  A desktop shortcut is the most common example. It is a small file that points to a program or document stored elsewhere on your drive, allowing you to open it without moving the original file. How do I find symbolic links in Ubuntu?  To see links in your current directory, run ls -la and look for files marked with an l permission (e.g., lrwxrwxrwx). To search for all symlinks in a directory and its subfolders, use find . -type l. How do I remove a symbolic link?  You can remove a symlink just like a regular file using rm [link_name] or unlink [link_name]. This deletes the link but leaves the original file untouched. What is the difference between a hard link and a symbolic (soft) link?  A symbolic link points to the location of a file (like a shortcut). If the original file is deleted, the link breaks. A hard link points to the actual data on the disk; even if you delete the original file name, the data remains accessible through the hard link.
19 January 2026 · 6 min to read
Linux

Linux Keyboard Shortcuts: Top Combinations for Users

Keyboard shortcuts in Linux are a great tool that can help you work more efficiently. Instead of using the mouse and navigating the menus, you can often press a couple of buttons to get you to the same result much quicker. Linux operating systems support a wide range of these shortcuts, or hotkeys. It’s important to note that each OS can have specific hotkeys that might not work in other distributions. However, you can fix that as users can add new or modify existing combinations in their system settings. Choose your server now! In this article, we will cover universal key combinations that are universal across different desktop environments. Most of the Linux hotkeys we examine are focused on working with the terminal. The commands in this article sometimes use the Super key, which corresponds to the Windows key in Windows OS or the Cmd key in macOS. For example, the shortcut to switch keyboard layouts Super + Space in Linux is similar to Windows + Space or Cmd + Space. Basic Linux Shortcuts Let’s start with basic general-purpose shortcuts. They help perform repetitive tasks more quickly. Alt + Tab or Super + Tab: Switches between windows. Similar to the function in Windows and other OSes. Super + Space: Switches between multiple keyboard layouts. Super + A: Opens the applications menu (usually located in the bottom left corner). F2: Used to rename files. Navigate to the file, click it once, then press F2 to rename. Ctrl + Alt + T: One of the most important and popular Linux shortcuts that opens the terminal window. Alt + F2: Opens a command prompt window in the center of the screen, where you can run a command or open a program. Super + D: Minimizes all windows to show the desktop. Ctrl + Alt + Del: Brings up a prompt with “Cancel” and “Log Out” options. The system logs out automatically if no selection is made within 60 seconds. These combinations help any specialist work more efficiently in Linux. But let’s move on to the more useful terminal-related hotkeys. Linux Terminal Shortcuts The terminal in Linux is the primary tool for interacting with the command shell. Below are terminal hotkeys that will help you work more efficiently. Terminal Window Management These shortcuts help open, switch, and close terminal tabs and windows quickly: Ctrl + Shift + Q: Completely closes the terminal window. Ctrl + Shift + T: Opens a new terminal tab. Ctrl + Shift + W: Closes the current terminal tab (or window if only one tab is open). Ctrl + Shift + D: Detaches the terminal tab into a separate window. Ctrl + PgUp / PgDown: Switches between terminal tabs (previous/next). Cursor Movement in a Line Linux users primarily use the keyboard in the terminal. To avoid switching to the mouse, here are some shortcuts for faster cursor navigation: Ctrl + A (or Home): Moves the cursor to the beginning of the line. Ctrl + E (or End): Moves the cursor to the end of the line. Ctrl + XX: Quickly moves the cursor to the beginning of the line; using it again returns it to the original position. Ctrl + → / ← or Alt + F / B: The first pair moves the cursor one word forward or backward. The second pair does the same using the Alt key. Input and Editing In addition to quickly moving the cursor along the line, you can also simplify input and editing of commands.  TAB: One of the main hotkeys in the Linux terminal, used for auto-completing commands or file paths. Pressing once completes the command; pressing twice suggests multiple completion options if available. Ctrl + T: Swaps the last two characters before the cursor. Alt + T: Similar to the previous shortcut but swaps the last two words before the cursor. Alt + Backspace: Deletes the word before the cursor. Alt + D: Deletes all characters after the cursor up to the next space. Alt + U / Alt + L: The first changes all characters to the right of the cursor to uppercase; the second to lowercase. Clipboard Operations These shortcuts allow interaction with the clipboard in the terminal: copying, cutting, or pasting parts of a line or the entire line. Ctrl + W: Deletes the word before the cursor. Ctrl + U: Deletes everything from the cursor to the beginning of the line. Ctrl + K: Deletes everything from the cursor to the end of the line. Ctrl + Y: Pastes the last deleted text from the clipboard using one of the three commands above. Command History Navigation Hotkeys also help interact with the command history in the terminal. This is useful when searching for previously used commands. To view the list of executed commands, use: history To quickly find and execute a previously used command, use the shortcuts below: Ctrl + R: Opens a search prompt to find a previously used command. Press Enter to run it, or Esc to edit or exit. Ctrl + O: Executes the command found using the shortcut above. Alt + <: Loads the first command from the command history. Screen Output Management The following shortcuts control the amount of information displayed in the terminal window and help focus on specific data even during a running process. Ctrl + C: Sends the SIGINT signal to the active process, immediately interrupting it. Ctrl + D: An alternative to exit, used to close the terminal. Often used in SSH sessions to disconnect from a remote host. Ctrl + Z: Suspends the active process and sends it to the background. Use the fg command to bring it back. Use jobs to list background processes. Ctrl + L: An alternative to the clear command, clears the terminal screen. Ctrl + S / Ctrl + Q: Ctrl + S pauses the terminal output; Ctrl + Q resumes it. Useful for stopping the screen output temporarily to examine or copy information. Adding and Modifying Hotkeys A Linux user may find that some combinations do not work or are missing entirely. Hotkeys may differ depending on the distribution as each system includes a default list of predefined shortcuts. However, in most Linux environments, users can create new shortcuts or modify existing ones.  Use Super + A to open the application menu. Use the search bar to find and open Settings. In the opened window, find and go to the Devices tab. Go to the Keyboard section. On the right side, a list of default hotkeys will appear. Click on any command to open the editing window and assign a new shortcut. If the desired command is not listed, you can add a custom one by clicking the + at the bottom. Enter its name, the command to execute, and the key combination. Choose your server now! Conclusion This article reviewed the main Linux hotkeys that simplify and speed up user workflow. It’s important to note that this is not a complete list. In addition to those listed, there are other combinations that cover different functionalities in Linux distributions. And if you’re looking for a reliable, high-performance, and budget-friendly solution for your workflows, Hostman has you covered with Linux VPS Hosting options, including Debian VPS, Ubuntu VPS, and VPS CentOS. Frequently Asked Questions (FAQ) What are the common shortcut keys for Linux?  While they vary by desktop environment (GNOME, KDE, etc.), standard global shortcuts include: Ctrl+Alt+T: Open a new Terminal window. Alt+Tab: Switch between open applications. Super Key (Windows Key): Open the Activities overview or Application menu. Alt+F4: Close the current window. What are the Linux shortcut keys for the terminal?  Terminal shortcuts differ from standard text editors. Key commands include: Ctrl+Shift+C / V: Copy and Paste text (standard Ctrl+C/V won't work). Ctrl+C: Interrupt (kill) the currently running process. Ctrl+L: Clear the terminal screen. Ctrl+A / Ctrl+E: Jump the cursor to the start or end of the line. How to set keyboard shortcuts in Linux?  Open your system Settings and select Keyboard. Scroll to the "Keyboard Shortcuts" section (sometimes under "View and Customize Shortcuts"). Here you can modify existing keys or add a custom shortcut by defining a command and pressing the desired key combination. How to use shortcuts on Linux?  Simply press the modifier keys (like Ctrl, Alt, or Super) and the action key simultaneously. Note that Linux shortcuts are case-sensitive regarding the Shift key; for example, Ctrl+c is different from Ctrl+Shift+C.
16 January 2026 · 7 min to read
Linux

How to Mount an SMB Share in Linux

The Server Message Block (SMB) protocol facilitates network file sharing, allowing applications to read and write to files and request services from server programs. This protocol is pivotal for seamless communication between different devices in a network, particularly in mixed OS environments like Windows and Linux. Users can access files on a Windows server or any SMB-enabled device straight from their Linux workstation by mounting an SMB share. In order to ensure seamless file sharing and network connectivity, this tutorial will walk you through the process of mounting an SMB share on Linux. Linux terminal is important tool to install SMB Share in Linux And if you’re looking for a reliable, high-performance, and budget-friendly solution for your workflows, Hostman has you covered with Linux VPS Hosting options, including Debian VPS, Ubuntu VPS, and VPS CentOS. Choose your server now! Prerequisites for Mounting SMB Shares Before mounting an SMB share, ensure the following prerequisites are met: A Linux system, such as a Hostman cheap cloud server, with root or sudo privileges. The cifs-utils package installed on your Linux system. Access credentials (username and password) for the SMB share. Network connectivity between your Linux system and the SMB server. Installing Necessary Packages The cifs-utils package is essential for mounting SMB shares on Linux. Additionally, the psmisc package provides the fuser command, which helps manage and monitor file usage. Update Package List and Upgrade System First, update your package list and upgrade your system: sudo apt update Install cifs-utils and psmisc Install the necessary packages: sudo apt install cifs-utils psmisc Verify Installation Verify the installation of cifs-utils and availability of the fuser command: mount -t cifsfuser Finding SMB Share Details Get the SMB share information, such as the share name and the server name or IP address. You may need to examine the server setup or speak with your network administrator. Example: Server: smbserver.example.com Share: sharedfolder Mounting SMB Shares Using the mount Command To mount the SMB share, use the mount command with the -t cifs option, specifying the SMB protocol. Create a directory to serve as the mount point: sudo mkdir /mnt/smb_share Mount the SMB share using the following command: sudo mount -t cifs -o username=your_username,password=your_password //192.0.2.17/SharedFiles /mnt/smb_share Replace your_username and your_password with your actual username and password. Ensure /mnt/smb_share is an existing directory. Verifying the Mount To confirm that the SMB share is successfully mounted, use the mount command: mount -t cifs Navigate to the mount point and list the files: cd /mnt/smb_sharels Creating a Credentials File Make a credentials file so you don't have to enter your credentials every time. This file has to be guarded and hidden. Use a text editor to create the file: nano ~/.smbcredentials Add the following content, replacing with your actual credentials: username=your_usernamepassword=your_password Set appropriate permissions for the file: sudo chown your_username: ~/.smbcredentialssudo chmod 600 ~/.smbcredentials Mount Using the Credentials File Mount the SMB share using the credentials file: sudo mount -t cifs -o credentials=~/.smbcredentials //192.168.2.12/SharedFiles /mnt/smb_share Quick example of how SMB Shared is mounted in Linux terminal Automating SMB Share Mounts To automate the mounting process, add an entry to the /etc/fstab file. This will ensure the SMB share is mounted at boot. 1. Open /etc/fstab for editing: sudo nano /etc/fstab 2. Add the following line: //smbserver.example.com/sharedfolder /mnt/smbshare cifs username=johndoe,password=securepassword,iocharset=utf8,sec=ntlm 0 0 3. Save and close the file. 4. Test the fstab entry: sudo mount -a Ensure no errors are displayed. Troubleshooting Common Issues Permission Denied Check your credentials and permissions on the SMB server. No Such File or Directory Ensure the server IP, share path, and mount point are correct. Mount Error 13 = Permission Denied Double-check your username and password. Mount Error 112 = Host is Down Verify network connectivity and server availability. Unmounting an SMB Share To unmount the SMB share, use the umount command followed by the mount point: sudo umount /mnt/smb_share Choose your server now! Conclusion Mounting an SMB share in Linux is a straightforward process that enhances file sharing capabilities across different operating systems. By following this tutorial, you can efficiently set up and troubleshoot SMB share mounts, facilitating seamless network communication and file access. Don't forget to check how to configure server image on Lunix! Frequently Asked Questions (FAQ) How do I mount an SMB share in Linux manually?  Use the mount command with the cifs type. The syntax is: sudo mount -t cifs -o username=[user] //server/share /mnt/local_mountpoint You will be prompted to enter the password for the SMB user. How do I mount a Samba share in Linux permanently?  To mount a share automatically at boot, add an entry to your /etc/fstab file. It generally looks like this: //server/share /mnt/point cifs username=user,password=pass 0 0 Note: For security, it is better to use a credentials file instead of putting the password directly in fstab. How do I mount an SMB share in CentOS/RHEL?  First, ensure the necessary utilities are installed by running sudo dnf install cifs-utils. Once installed, the mount process is the same as other distributions: sudo mount -t cifs -o username=[user] //server/share /mnt/point What do I do if I get a "wrong fs type" error?  This usually means the helper utilities are missing. On Ubuntu/Debian, run sudo apt install cifs-utils. On CentOS/Fedora, run sudo dnf install cifs-utils. How do I unmount the share when I'm done?  Use the umount command followed by the local directory: sudo umount /mnt/local_mountpoint
14 January 2026 · 5 min to read

Do you have questions,
comments, or concerns?

Our professionals are available to assist you at any moment,
whether you need help or are just unsure of where to start.
Email us
Hostman's Support