Mozilla
Mozilla
Over 3,500,000+
LFCA: Learn Basic File Readers
Management Commands in
Linux – Part 2
James Kiarie Last Updated: March 26, 2021 LFCA, Linux
Certi�cations 3 Comments
1 of 31
This article is Part 2 of the LFCA series, here in this part, we
will explain about Linux �le system and cover the basic �le
management commands, that are required for the LFCA
certi�cation exam.
2 of 31
Simple text �les, pdf �les
Multimedia �les such as image, music, and video �les
Binary �les
Zipped or compressed �les
2. Special Files
3. Directories
Learn Linux
Commands and
Tools
3 of 31
Let’s understand each directory and its usage. 6 Best CLI Tools to
Search Plain-Text
The /root directory is the home directory for the root Data Using Regular
user. Expressions
The /dev directory contains device �les such as
How to Find and Kill
/dev/sda.
Running Processes in
Static boot �les are located in the /boot directory.
Linux
Applications and user utilities are found in the /usr
directory. How to Append Text
The /var directory contains log �les of various system to End of File in Linux
applications.
7 ‘dmesg’
All system con�guration �les are stored in the /etc
directory. Commands for
Troubleshooting and
The /home directory is where user folders are located.
Collecting
These include Desktop, Documents, Downloads,
Information of Linux
Music, Public, and Videos.
For add-on application packages, check them out in Systems
The /bin directory contains user command binary �les. TecMint, You Should
kernel modules.
4 of 31
You will spend a great deal of time interacting with the
terminal where you will be running commands. Executing
commands is the most preferred way of interacting with a
Linux system as it gives you total control over the system
compared to using the graphical display elements.
1. pwd Command
$ pwd
5 of 31
Print Current Working Directory
2. cd Command
$ cd /var/log
$ cd ..
$ cd
6 of 31
cd Command Examples
$ cd Downloads
7 of 31
Navigate to Downloads Directory
3. ls Command
$ ls
From the output, we can see that we have two text �les and
eight folders which are usually created by default after
installing and logging in to the system.
8 of 31
List Files in Linux
$ ls -lh
9 of 31
Long List Files in Linux
$ ls -la
.ssh
.config
.local
List Hidden Files in Linux
10 of 31
4. touch Command
$ touch filename
$ touch file1.txt
$ ls
11 of 31
Create Empty File in Linux
5. cat Command
$ cat filename
6. mv Command
The mv command is quite a versatile command. Depending
12 of 31
on how it is used, it can rename a �le or move it from one
location to another.
$ mv filename /path/to/destination/
$ mv file1.txt Public/docs
Alternatively, you can move a �le from a different location to
13 of 31
your current directory using the syntax shown. Take note of
the period sign at the end of the command. This implies this
location’.
$ mv /path/to/file .
$ mv Public/docs/file1.txt .
14 of 31
argument as the new �le name.
$ mv filename1 filename2
$ mv file1.txt file2.txt
Additionally, you can move and rename the �le at the same
time by specifying the destination folder and a different �le
name.
For example to move �le1.txt to the location Public/docs and
15 of 31
rename it �le2.txt run the command:
$ mv file1.txt Public/docs/file2.txt
7. cp Command
The cp command, short for copy, copies a �le from one �le
location to another. Unlike the move command, the cp
command retains the original �le in its current location and
makes a duplicate copy in a different directory.
16 of 31
$ cp /file/path /destination/path
$ cp file1.txt Public/docs/
17 of 31
$ cp -R tutorials Public/docs/
8. mkdir Command
$ mkdir directory_name
18 of 31
$ mkdir projects
$ mkdir -p projects/linux/fundamentals
19 of 31
Create Directory in Linux
9. rmdir Command
$ rmdir tutorials
20 of 31
Delete Empty Directory in Linux
$ rmdir projects
21 of 31
10. rm Command
$ rm filename
$ rm file1.txt
$ rm -R directory_name
$ rm -R projects
22 of 31
Delete Directory Recursively in Linux
23 of 31
Search Files in Linux
The locate command, just like the �nd command, plays the
same role of searching �les but only takes one argument as
shown.
$ locate filename
For example;
$ locate file1.txt
24 of 31
Locate Files in Linux
25 of 31
LFCA: Understanding Linux LFCA: Learn Basic Linux System
Operating System – Part 1 Commands – Part 3
26 of 31
If You Appreciate What We Do Here
On TecMint, You Should Consider:
Related Posts
LFCA: Learn LFCA: Learn LFCA: Learn
27 of 31
Software the Basic the Basic
Deployment Concepts of Concepts of
Environments Using DevOps – Part
– Part 23 Containers – 21
Part 22
Anupa patil
July 19, 2021 at 7:20 pm
28 of 31
Your explanation is too excellent. I can understand
very easily..
Thank you
Reply
Gérard Talbot
April 21, 2021 at 7:16 pm
Gérard
Reply
dragonmouth
April 20, 2021 at 7:10 pm
James,
29 of 31
-rf” command as its improper use can wipe an entire
directory, an entire HOME directory, or if used with
superuser privileges, the ENTIRE system.
Reply
Got
Linux something to say?
Server Monitoring ToolsJoin Learn
the Linux Tricks & Tips
discussion.
TCP�ow – Analyze and Debug Network How to Convert From RPM to DEB and
Traf�c
Have ain Linux or suggestion? Please leave a DEB
question to RPM
comment to Package Using Alien
start the discussion. Please keep in mind that all comments
How to Monitor Apache Web Server Find Top Running Processes by Highest
are moderated and your email address will NOT be
Load and Page Statistics Memory and CPU Usage in Linux
published.
CloudStats.me – Monitors Your Linux 4 Ways to Disable Root Account in
Servers and Websites from the Cloud Linux
How to Monitor System Usage, Outages How to Encrypt and Decrypt Files and
and Troubleshoot Linux Servers – Part 9 Directories Using Tar and OpenSSL
All You Need To Know About Processes How to Set or Change System
in Linux [Comprehensive Guide] Hostname in Linux
Name *
Best
EmailLinux
* Tools
30 of 31
8 Best PDF Document Viewers for Linux Systems
Tecmint: Linux Howtos, Tutorials & Guides © 2021. All Rights Reserved.
The material in this site cannot be republished either online or of�ine, without our permission.
31 of 31