Skip to main content

Basic FAQ for Linux Users

Basic FAQ for Linux Users

1. How do I log in to a remote server using SSH?

Command:

ssh username@hostname 

Explanation:

  • ssh: Secure Shell, a protocol for securely accessing a remote machine.
  • username: Your username on the remote machine.
  • hostname: The address of the remote machine (e.g., IP address or domain name).

2. How do I run graphical applications over SSH?

Command:

ssh -X username@hostname 

Explanation:

  • ssh -X: Enables X11 forwarding, allowing you to run graphical applications on the remote machine and display them on your local machine.

3. How do I copy files from my local machine to a remote server using SCP?

Command:

scp /path/to/local/file username@hostname:/path/to/remote/directory 

Explanation:

  • scp: Secure Copy, a command for transferring files securely between hosts.
  • /path/to/local/file: Path to the file on your local machine.
  • username@hostname: Your username and the address of the remote machine.
  • /path/to/remote/directory: Path to the destination directory on the remote machine.

4. How do I copy files from a remote server to my local machine using SCP?

Command:

scp username@hostname:/path/to/remote/file /path/to/local/directory 

Explanation:

  • /path/to/remote/file: Path to the file on the remote machine.
  • /path/to/local/directory: Path to the destination directory on your local machine.

5. How do I synchronize directories between my local machine and a remote server using Rsync?

Command to sync local to remote:

rsync -avz /path/to/local/directory username@hostname:/path/to/remote/directory 

Command to sync remote to local:

rsync -avz username@hostname:/path/to/remote/directory /path/to/local/directory 

Explanation:

  • rsync: Remote Sync, a utility for efficiently transferring and synchronizing files across computer systems.
  • -a: Archive mode, which preserves permissions, timestamps, symbolic links, etc.
  • -v: Verbose mode, which provides detailed output of the transfer process.
  • -z: Compression, which compresses file data during the transfer.

6. How do I check the disk space usage of a directory?

Command:

du -sh /path/to/directory

Explanation:

  • du: Disk Usage, a command to estimate file space usage.
  • -s: Summarize, showing only the total for each argument.
  • -h: Human-readable, showing sizes in KB, MB, or GB.

7. How do I check the available disk space on the file system?

Command:

df -h

Explanation:

  • df: Disk Free, a command to report file system disk space usage.
  • -h: Human-readable, showing sizes in KB, MB, or GB.

8. How do I find a specific file in my file system?

Command:

find /path/to/search -name "filename"

Explanation:

  • find: A command to search for files in a directory hierarchy.
  • /path/to/search: The directory to start the search.
  • -name "filename": The name of the file to search for.

9. How do I display the contents of a text file?

Command:

cat /path/to/file

Explanation:

  • cat: Concatenate and display the content of files.

10. How do I monitor real-time system processes?

Command:

top 

Explanation:

  • top: A task manager program displaying real-time system summary information and a list of processes or threads currently being managed by the Linux kernel.