SlideShare a Scribd company logo
Linux For Embedded Systems
ForArabs
Ahmed ElArabawy
Course 102:
UnderstandingLinux
Lecture 3:
Basic Concepts and Commands
Files & Filenames
• Filenames can use any characters
abc??##.a1 sta*.pn
But it is not wise to use special characters in filenames
spaces are accepted but not recommended, use dashes or underscores instead
test results.txt => test_results.txt or test-results.txt
• File names are case sensitive
Test_results.doc test_results.doc
But avoid creating files with same names with difference in case
• File names starting with a dot are hidden files
.bashrc .profile
• No concept of file extension, the dot is just another character
file.txt.old .bashrc file.doc.mod .profile.old results.yesterday results
Still it is a good idea to stick to the popular extensions for clarity
Paths
• Directory names separated by slashes ‘/’
/usr/src/shared/files/myfile.txt
• Can be absolute or relative
• Absolute: Does not depend on where you are
/home/aelarabawy/abcd
~/abcd
~ means /home/aelarabawy (home directory of current user)
~salah means /home/salah (home directory of the user salah)
• Relative: Depends where you are in the tree
./my-project/progress-reports
../../my-project/progress-reports
. means Current Directory
.. Means Parent Directory
Commands
• General form of Commands,
$ <command> [options] [arguments]
• Commands can be issued on their own
$ ls
$ pwd
$ cd
• The Options are normally optional (by definition)
The usually start with ‘-’ or ‘--’
‘-’ used with the short name for the option
$ ls -a
‘--‘ used with the long name for the option
$ ls --all
We normally use the short name in CLI and the long name in scripts (for
clarity)
Commands
• If we want to use multiple options Sometimes we join options
or keep them separate
$ ls -a -R
$ ls -aR
$ ls --all --recursive
• Sometimes a ‘--‘ without a name afterwards will mean end of
options (even a following hyphen will not be considered a new
option)
• Arguments are those info passed to the command such as file
names and paths
$ rm -rf ./project-data
Basic Commands
Command Effect
$ ls To list files
$ tree To list a tree of files
$ pwd To show the current directory
$ cd To move around in the tree
$ mkdir To Create directories
$ cp To copy files and directories
$ mv To move or rename files and
directories
$ rm To delete files and directories
$ clear To clear the screen
Listing Files
(ls Command)
$ ls (List Current Directory)
Listing Files
(ls Command)
$ ls -a (List all files, including hidden files)
Listing Files
(ls Command)
$ ls -l (List with long format)
Listing Files
(ls Command)
$ ls -l (List with long format)
Listing Files
(ls Command)
$ ls [options] [<dir or file> ..]
$ ls (list current directory)
$ ls -a (all: show hidden files)
$ ls -l (long: show file details)
$ ls -t (timestamp: sort based on timestamp)
$ ls -S (Size: sort based on file size)
$ ls -r (reverse: make the sort in reverse order)
$ ls -d (directories: Only show directories)
$ ls -R (Recursive: list files inside subdirectories)
$ ls <dir> (List the contents of the mentioned directory)
$ ls <file> (List the mentioned)
$ ls <dir or file> <dir or file> <dir or file> (list selected dirs or files)
Or a Mix of These Options
Displaying the Directory Tree
(tree Command)
$ tree (List tree from Current Directory)
Displaying the Directory Tree
(tree Command)
$ tree -a (List tree from Current Directory)
Displaying the Directory Tree
(tree Command)
$ tree [options] [<dir or file> ..]
$ tree (display the full tree starting from current dir)
$ tree -d (only show directories)
$ tree -a (show all files; including hidden ones)
$ tree <dir> (show the tree starting from a different point)
Or a Mix of These Options
Print Working Directory
(pwd Command)
$ pwd
$ pwd (Display Current Directory)
Moving Around
(cd Command)
$ cd [destination]
$ pwd
/home/bio1/
Moving Around
(cd Command)
$ cd [destination]
$ cd /usr/local
Moving Around
(cd Command)
$ cd [destination]
$ cd /usr/local/bin
$ cd ./bin
$ cd bin
Moving Around
(cd Command)
$ cd [destination]
$ cd /usr/etc
$ cd ../../etc
Moving Around
(cd Command)
$ cd [destination]
$ cd ~
$ cd
Moving Around
(cd Command)
$ cd [destination]
$ cd /etc/network (absolute path)
$ cd ../project/ (relative path)
$ cd ./project (relative path)
$ cd project (relative path, same as ./project)
$ cd ~ (go to my home directory /home/aelarabawy/)
$ cd ~user_name (go to /home/user_name)
$ cd (same as cd ~)
$ cd .. (go to parent directory)
$ cd - (go to previous directory)
Making New Directories
(mkdir Command)
$ mkdir <new directory name with path>
Making New Directories
(mkdir Command)
$ mkdir <new directory name with path>
$ mkdir documents
$ mkdir ./documents
$ mkdir /home/tom/documents
$ mkdir ~/documents
Making New Directories
(mkdir Command)
$ mkdir <new directory name with path>
$ mkdir documents/text
Making New Directories
(mkdir Command)
$ mkdir <new directory name with path>
$ cd documents
$ mkdir text
Making New Directories
(mkdir Command)
$ mkdir <new directory name with path>
$ mkdir documents/text
Making New Directories
(mkdir Command)
$ mkdir <new directory name with path>
$ mkdir -p documents/text
Making New Directories
(mkdir Command)
$ mkdir <new directory name with path>
$ mkdir project1 (create a new directory from current location)
$ mkdir project1 project2 (create 2 directories)
$ mkdir /home/aelarabawy/lectures (absolute path)
$ mkdir ../projects/project1 (relative path)
$ mkdir -p ../projects/project1 (create intermediate folders if needed)
Copying Files & Directories
(cp Commands)
$ cp <existing file or dir> <new filename & destination>
science.doc
Copying Files & Directories
(cp Commands)
$ cp <existing file or dir> <new filename & destination>
science.doc
$ cp ~/books/science.doc ~/school/science.doc
science.doc
$ cp ~/books/science.doc ~/school/
Copying Files & Directories
(cp Commands)
$ cp <existing file or dir> <new filename & destination>
science.doc science.doc
$ cp /home/bill/school /home/patrick/
Copying Files & Directories
(cp Commands)
$ cp <existing file or dir> <new filename & destination>
science.doc science.doc
$ sudo cp /home/bill/school /home/patrick/
Copying Files & Directories
(cp Commands)
$ cp <existing file or dir> <new filename & destination>
science.doc science.doc
$ sudo cp -r /home/bill/school /home/patrick
science.doc
Copying Files & Directories
(cp Commands)
$ cp <existing file or dir> <new destination>
$ cp file1 file2 (copy file1 to a new file file2 same location)
$ cp file1 ../projects/ (copy file1 to the new location)
$ cp -r folder1 ../projects/ (copy the folder with its contents)
$ cp -r folder1 ../projects/folder2 (copy the folder with new name)
$ cp /etc/passwd . (copy the file …to here )
Moving/RenamingFiles & Directories
(mv Command)
$ mv <existing file or dir> <new filename & destination>
science.doc
Moving/RenamingFiles & Directories
(mv Command)
$ mv <existing file or dir> <new filename & destination>
$ mv ~/books/science.doc ~/school/science.doc
science.doc
$ mv ~/books/science.doc ~/school/
Moving/RenamingFiles & Directories
(mv Command)
$ mv <existing file or dir> <new filename & destination>
science.doc
$ mv /home/bill/school /home/patrick/
Moving/RenamingFiles & Directories
(mv Command)
$ mv <existing file or dir> <new filename & destination>
science.doc
$ sudo mv /home/bill/shool /home/patrick/
Moving/RenamingFiles & Directories
(mv Command)
$ mv <existing file or dir> <new filename & destination>
science.doc
$ sudo mv -r /home/bill/school /home/patrick
science.doc
Moving/RenamingFiles & Directories
(mv Command)
$ mv <existing file or dir> <new destination>
$ mv file1 file2 (rename file1 to file2)
$ mv file1 ../projects/ (move file1 to the new location)
$ mv -r folder1 ../projects/ (move the folder with its contents)
$ mv -r folder1 ../projects/folder2 (move with new name)
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
file.cfgprog1prog2prog3
util1 util2
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
file.cfgprog1prog2prog3
$ cd /usr/local/sbin
util1 util2
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
file.cfgprog2prog3$ rm prog1
util1 util2
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
prog2prog3$ rm ../etc/file.cfg
util1 util2
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
prog2prog3$ cd ../bin
util1 util2
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
util1 util2
$ rm prog3 prog2
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
util1 util2
$ cd /usr/bin/utils
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
$ rm -r /usr/bin/utils
util1 util2
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
util1 util2
$ cd -
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
$ rm -r /usr/bin/utils
Removing files and Directories
(rm Command)
$ rm [options] <file or dir list>
$ rm file1 file2 (remove file1 and file2)
$ rm -r ../projects/folder1 (remove the folder with its content)
$ rm -i file1 file2 (interactive, ask me before you remove)
$ rm -f ../projects/folder1 (force, force remove)
• Note
• To remove directories you need always to use ‘-r’
• You can not remove your current directory (or any of its parents)
http://Linux4EmbeddedSystems.com

More Related Content

PDF
Course 102: Lecture 5: File Handling Internals
PDF
Course 102: Lecture 2: Unwrapping Linux
PDF
Course 102: Lecture 1: Course Overview
PDF
Course 102: Lecture 22: Package Management
PDF
Course 101: Lecture 1: Introduction to Embedded Systems
PDF
Course 102: Lecture 24: Archiving and Compression of Files
PDF
ChatGPT and the Future of Work - Clark Boyd
PDF
PRESENTATION ON ‘ TYPE A ’ AND ‘ TYPE B ’ PERSONALITY
Course 102: Lecture 5: File Handling Internals
Course 102: Lecture 2: Unwrapping Linux
Course 102: Lecture 1: Course Overview
Course 102: Lecture 22: Package Management
Course 101: Lecture 1: Introduction to Embedded Systems
Course 102: Lecture 24: Archiving and Compression of Files
ChatGPT and the Future of Work - Clark Boyd
PRESENTATION ON ‘ TYPE A ’ AND ‘ TYPE B ’ PERSONALITY

What's hot (20)

PDF
Course 102: Lecture 4: Using Wild Cards
PDF
Course 102: Lecture 6: Seeking Help
PDF
Course 102: Lecture 10: Learning About the Shell
PDF
Course 102: Lecture 8: Composite Commands
PDF
Course 102: Lecture 7: Simple Utilities
PDF
Course 102: Lecture 9: Input Output Internals
PDF
Introduction to the linux command line.pdf
PDF
Shell scripting
PPTX
Unix Linux Commands Presentation 2013
PDF
Course 102: Lecture 12: Basic Text Handling
PDF
Course 102: Lecture 14: Users and Permissions
PPTX
Linux architecture
PDF
Part 02 Linux Kernel Module Programming
PDF
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
PPTX
Bash Shell Scripting
PDF
Linux Basic Commands
PPTX
Linux basic commands
PPTX
Linux System Programming - File I/O
PPT
Basic 50 linus command
PPTX
Linux standard file system
Course 102: Lecture 4: Using Wild Cards
Course 102: Lecture 6: Seeking Help
Course 102: Lecture 10: Learning About the Shell
Course 102: Lecture 8: Composite Commands
Course 102: Lecture 7: Simple Utilities
Course 102: Lecture 9: Input Output Internals
Introduction to the linux command line.pdf
Shell scripting
Unix Linux Commands Presentation 2013
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 14: Users and Permissions
Linux architecture
Part 02 Linux Kernel Module Programming
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
Bash Shell Scripting
Linux Basic Commands
Linux basic commands
Linux System Programming - File I/O
Basic 50 linus command
Linux standard file system
Ad

Viewers also liked (15)

PDF
Course 101: Lecture 4: A Tour in RTOS Land
PDF
Course 101: Lecture 2: Introduction to Operating Systems
PDF
Course 101: Lecture 6: Installing Ubuntu
PDF
Course 101: Lecture 5: Linux & GNU
PDF
Course 102: Lecture 11: Environment Variables
PDF
Course 102: Lecture 13: Regular Expressions
PDF
Embedded Systems: Lecture 6: Linux & GNU
PDF
Embedded Systems: Lecture 8: The Raspberry Pi as a Linux Box
PDF
Embedded Systems: Lecture 5: A Tour in RTOS Land
PDF
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
PDF
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
PDF
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
PDF
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
PDF
Embedded Systems: Lecture 4: Selecting the Proper RTOS
PDF
Embedded Systems: Lecture 2: Introduction to Embedded Systems
Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 5: Linux & GNU
Course 102: Lecture 11: Environment Variables
Course 102: Lecture 13: Regular Expressions
Embedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 8: The Raspberry Pi as a Linux Box
Embedded Systems: Lecture 5: A Tour in RTOS Land
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
Embedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 2: Introduction to Embedded Systems
Ad

Similar to Course 102: Lecture 3: Basic Concepts And Commands (20)

PPT
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
PPT
LinuxLabBasics.ppt
PPTX
Linux System commands Essentialsand Basics.pptx
DOCX
Basic linux commands
PDF
Basic shell programs assignment 1_solution_manual
PDF
Basic unix commands
DOC
Unix Basics For Testers
PPTX
Directory Management in Unix
PPT
101 3.3 perform basic file management
DOCX
Directories description
PPTX
Know the UNIX Commands
DOCX
Linux basic commands
PPTX
Introduction to linux day-3
PDF
linux commands.pdf
PDF
Unit3 browsing the filesystem
PPT
intro unix/linux 07
PDF
Linux_Ch2 Lecture (1).pdf
PPT
Linux ppt
PDF
Linux Bash Shell Cheat Sheet for Beginners
PDF
Lecture1 2 intro-unix
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
LinuxLabBasics.ppt
Linux System commands Essentialsand Basics.pptx
Basic linux commands
Basic shell programs assignment 1_solution_manual
Basic unix commands
Unix Basics For Testers
Directory Management in Unix
101 3.3 perform basic file management
Directories description
Know the UNIX Commands
Linux basic commands
Introduction to linux day-3
linux commands.pdf
Unit3 browsing the filesystem
intro unix/linux 07
Linux_Ch2 Lecture (1).pdf
Linux ppt
Linux Bash Shell Cheat Sheet for Beginners
Lecture1 2 intro-unix

More from Ahmed El-Arabawy (10)

PDF
C 102 lec_29_what_s_next
PDF
Course 102: Lecture 28: Virtual FileSystems
PDF
Course 102: Lecture 27: FileSystems in Linux (Part 2)
PDF
Course 102: Lecture 26: FileSystems in Linux (Part 1)
PDF
Course 102: Lecture 25: Devices and Device Drivers
PDF
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
PDF
Course 102: Lecture 19: Using Signals
PDF
Course 102: Lecture 18: Process Life Cycle
PDF
Course 102: Lecture 17: Process Monitoring
PDF
Course 102: Lecture 16: Process Management (Part 2)
C 102 lec_29_what_s_next
Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 19: Using Signals
Course 102: Lecture 18: Process Life Cycle
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 16: Process Management (Part 2)

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Modernizing your data center with Dell and AMD
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation theory and applications.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Cloud computing and distributed systems.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
NewMind AI Monthly Chronicles - July 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectral efficient network and resource selection model in 5G networks
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Modernizing your data center with Dell and AMD
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation theory and applications.pdf
Unlocking AI with Model Context Protocol (MCP)
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Encapsulation_ Review paper, used for researhc scholars
Dropbox Q2 2025 Financial Results & Investor Presentation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Machine learning based COVID-19 study performance prediction
Network Security Unit 5.pdf for BCA BBA.
Cloud computing and distributed systems.
Advanced methodologies resolving dimensionality complications for autism neur...

Course 102: Lecture 3: Basic Concepts And Commands

  • 1. Linux For Embedded Systems ForArabs Ahmed ElArabawy Course 102: UnderstandingLinux
  • 3. Files & Filenames • Filenames can use any characters abc??##.a1 sta*.pn But it is not wise to use special characters in filenames spaces are accepted but not recommended, use dashes or underscores instead test results.txt => test_results.txt or test-results.txt • File names are case sensitive Test_results.doc test_results.doc But avoid creating files with same names with difference in case • File names starting with a dot are hidden files .bashrc .profile • No concept of file extension, the dot is just another character file.txt.old .bashrc file.doc.mod .profile.old results.yesterday results Still it is a good idea to stick to the popular extensions for clarity
  • 4. Paths • Directory names separated by slashes ‘/’ /usr/src/shared/files/myfile.txt • Can be absolute or relative • Absolute: Does not depend on where you are /home/aelarabawy/abcd ~/abcd ~ means /home/aelarabawy (home directory of current user) ~salah means /home/salah (home directory of the user salah) • Relative: Depends where you are in the tree ./my-project/progress-reports ../../my-project/progress-reports . means Current Directory .. Means Parent Directory
  • 5. Commands • General form of Commands, $ <command> [options] [arguments] • Commands can be issued on their own $ ls $ pwd $ cd • The Options are normally optional (by definition) The usually start with ‘-’ or ‘--’ ‘-’ used with the short name for the option $ ls -a ‘--‘ used with the long name for the option $ ls --all We normally use the short name in CLI and the long name in scripts (for clarity)
  • 6. Commands • If we want to use multiple options Sometimes we join options or keep them separate $ ls -a -R $ ls -aR $ ls --all --recursive • Sometimes a ‘--‘ without a name afterwards will mean end of options (even a following hyphen will not be considered a new option) • Arguments are those info passed to the command such as file names and paths $ rm -rf ./project-data
  • 7. Basic Commands Command Effect $ ls To list files $ tree To list a tree of files $ pwd To show the current directory $ cd To move around in the tree $ mkdir To Create directories $ cp To copy files and directories $ mv To move or rename files and directories $ rm To delete files and directories $ clear To clear the screen
  • 8. Listing Files (ls Command) $ ls (List Current Directory)
  • 9. Listing Files (ls Command) $ ls -a (List all files, including hidden files)
  • 10. Listing Files (ls Command) $ ls -l (List with long format)
  • 11. Listing Files (ls Command) $ ls -l (List with long format)
  • 12. Listing Files (ls Command) $ ls [options] [<dir or file> ..] $ ls (list current directory) $ ls -a (all: show hidden files) $ ls -l (long: show file details) $ ls -t (timestamp: sort based on timestamp) $ ls -S (Size: sort based on file size) $ ls -r (reverse: make the sort in reverse order) $ ls -d (directories: Only show directories) $ ls -R (Recursive: list files inside subdirectories) $ ls <dir> (List the contents of the mentioned directory) $ ls <file> (List the mentioned) $ ls <dir or file> <dir or file> <dir or file> (list selected dirs or files) Or a Mix of These Options
  • 13. Displaying the Directory Tree (tree Command) $ tree (List tree from Current Directory)
  • 14. Displaying the Directory Tree (tree Command) $ tree -a (List tree from Current Directory)
  • 15. Displaying the Directory Tree (tree Command) $ tree [options] [<dir or file> ..] $ tree (display the full tree starting from current dir) $ tree -d (only show directories) $ tree -a (show all files; including hidden ones) $ tree <dir> (show the tree starting from a different point) Or a Mix of These Options
  • 16. Print Working Directory (pwd Command) $ pwd $ pwd (Display Current Directory)
  • 17. Moving Around (cd Command) $ cd [destination] $ pwd /home/bio1/
  • 18. Moving Around (cd Command) $ cd [destination] $ cd /usr/local
  • 19. Moving Around (cd Command) $ cd [destination] $ cd /usr/local/bin $ cd ./bin $ cd bin
  • 20. Moving Around (cd Command) $ cd [destination] $ cd /usr/etc $ cd ../../etc
  • 21. Moving Around (cd Command) $ cd [destination] $ cd ~ $ cd
  • 22. Moving Around (cd Command) $ cd [destination] $ cd /etc/network (absolute path) $ cd ../project/ (relative path) $ cd ./project (relative path) $ cd project (relative path, same as ./project) $ cd ~ (go to my home directory /home/aelarabawy/) $ cd ~user_name (go to /home/user_name) $ cd (same as cd ~) $ cd .. (go to parent directory) $ cd - (go to previous directory)
  • 23. Making New Directories (mkdir Command) $ mkdir <new directory name with path>
  • 24. Making New Directories (mkdir Command) $ mkdir <new directory name with path> $ mkdir documents $ mkdir ./documents $ mkdir /home/tom/documents $ mkdir ~/documents
  • 25. Making New Directories (mkdir Command) $ mkdir <new directory name with path> $ mkdir documents/text
  • 26. Making New Directories (mkdir Command) $ mkdir <new directory name with path> $ cd documents $ mkdir text
  • 27. Making New Directories (mkdir Command) $ mkdir <new directory name with path> $ mkdir documents/text
  • 28. Making New Directories (mkdir Command) $ mkdir <new directory name with path> $ mkdir -p documents/text
  • 29. Making New Directories (mkdir Command) $ mkdir <new directory name with path> $ mkdir project1 (create a new directory from current location) $ mkdir project1 project2 (create 2 directories) $ mkdir /home/aelarabawy/lectures (absolute path) $ mkdir ../projects/project1 (relative path) $ mkdir -p ../projects/project1 (create intermediate folders if needed)
  • 30. Copying Files & Directories (cp Commands) $ cp <existing file or dir> <new filename & destination> science.doc
  • 31. Copying Files & Directories (cp Commands) $ cp <existing file or dir> <new filename & destination> science.doc $ cp ~/books/science.doc ~/school/science.doc science.doc $ cp ~/books/science.doc ~/school/
  • 32. Copying Files & Directories (cp Commands) $ cp <existing file or dir> <new filename & destination> science.doc science.doc $ cp /home/bill/school /home/patrick/
  • 33. Copying Files & Directories (cp Commands) $ cp <existing file or dir> <new filename & destination> science.doc science.doc $ sudo cp /home/bill/school /home/patrick/
  • 34. Copying Files & Directories (cp Commands) $ cp <existing file or dir> <new filename & destination> science.doc science.doc $ sudo cp -r /home/bill/school /home/patrick science.doc
  • 35. Copying Files & Directories (cp Commands) $ cp <existing file or dir> <new destination> $ cp file1 file2 (copy file1 to a new file file2 same location) $ cp file1 ../projects/ (copy file1 to the new location) $ cp -r folder1 ../projects/ (copy the folder with its contents) $ cp -r folder1 ../projects/folder2 (copy the folder with new name) $ cp /etc/passwd . (copy the file …to here )
  • 36. Moving/RenamingFiles & Directories (mv Command) $ mv <existing file or dir> <new filename & destination> science.doc
  • 37. Moving/RenamingFiles & Directories (mv Command) $ mv <existing file or dir> <new filename & destination> $ mv ~/books/science.doc ~/school/science.doc science.doc $ mv ~/books/science.doc ~/school/
  • 38. Moving/RenamingFiles & Directories (mv Command) $ mv <existing file or dir> <new filename & destination> science.doc $ mv /home/bill/school /home/patrick/
  • 39. Moving/RenamingFiles & Directories (mv Command) $ mv <existing file or dir> <new filename & destination> science.doc $ sudo mv /home/bill/shool /home/patrick/
  • 40. Moving/RenamingFiles & Directories (mv Command) $ mv <existing file or dir> <new filename & destination> science.doc $ sudo mv -r /home/bill/school /home/patrick science.doc
  • 41. Moving/RenamingFiles & Directories (mv Command) $ mv <existing file or dir> <new destination> $ mv file1 file2 (rename file1 to file2) $ mv file1 ../projects/ (move file1 to the new location) $ mv -r folder1 ../projects/ (move the folder with its contents) $ mv -r folder1 ../projects/folder2 (move with new name)
  • 42. Removing files and Directories (rm Command) $ rm [options] <file or dir list> file.cfgprog1prog2prog3 util1 util2
  • 43. Removing files and Directories (rm Command) $ rm [options] <file or dir list> file.cfgprog1prog2prog3 $ cd /usr/local/sbin util1 util2
  • 44. Removing files and Directories (rm Command) $ rm [options] <file or dir list> file.cfgprog2prog3$ rm prog1 util1 util2
  • 45. Removing files and Directories (rm Command) $ rm [options] <file or dir list> prog2prog3$ rm ../etc/file.cfg util1 util2
  • 46. Removing files and Directories (rm Command) $ rm [options] <file or dir list> prog2prog3$ cd ../bin util1 util2
  • 47. Removing files and Directories (rm Command) $ rm [options] <file or dir list> util1 util2 $ rm prog3 prog2
  • 48. Removing files and Directories (rm Command) $ rm [options] <file or dir list> util1 util2 $ cd /usr/bin/utils
  • 49. Removing files and Directories (rm Command) $ rm [options] <file or dir list> $ rm -r /usr/bin/utils util1 util2
  • 50. Removing files and Directories (rm Command) $ rm [options] <file or dir list> util1 util2 $ cd -
  • 51. Removing files and Directories (rm Command) $ rm [options] <file or dir list> $ rm -r /usr/bin/utils
  • 52. Removing files and Directories (rm Command) $ rm [options] <file or dir list> $ rm file1 file2 (remove file1 and file2) $ rm -r ../projects/folder1 (remove the folder with its content) $ rm -i file1 file2 (interactive, ask me before you remove) $ rm -f ../projects/folder1 (force, force remove) • Note • To remove directories you need always to use ‘-r’ • You can not remove your current directory (or any of its parents)