SlideShare a Scribd company logo
1 of 53
Download to read offline
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

What's hot

Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Ahmed El-Arabawy
 
Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Ahmed El-Arabawy
 
Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Ahmed El-Arabawy
 
Course 101: Lecture 5: Linux & GNU
Course 101: Lecture 5: Linux & GNU Course 101: Lecture 5: Linux & GNU
Course 101: Lecture 5: Linux & GNU Ahmed El-Arabawy
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Ahmed El-Arabawy
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Ahmed El-Arabawy
 
Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals Ahmed El-Arabawy
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell ScriptingRaghu nath
 
Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Ahmed El-Arabawy
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commandsSagar Kumar
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Scriptsbmguys
 
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Ahmed El-Arabawy
 
User Administration in Linux
User Administration in LinuxUser Administration in Linux
User Administration in LinuxSAMUEL OJO
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Ahmed El-Arabawy
 
Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 28: Virtual FileSystems Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 28: Virtual FileSystems Ahmed El-Arabawy
 
Shell & Shell Script
Shell & Shell Script Shell & Shell Script
Shell & Shell Script Amit Ghosh
 

What's hot (20)

Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals Course 102: Lecture 9: Input Output Internals
Course 102: Lecture 9: Input Output Internals
 
Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview
 
Shell Scripting
Shell ScriptingShell Scripting
Shell Scripting
 
Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions
 
Course 101: Lecture 5: Linux & GNU
Course 101: Lecture 5: Linux & GNU Course 101: Lecture 5: Linux & GNU
Course 101: Lecture 5: Linux & GNU
 
Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring Course 102: Lecture 17: Process Monitoring
Course 102: Lecture 17: Process Monitoring
 
Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1) Course 102: Lecture 26: FileSystems in Linux (Part 1)
Course 102: Lecture 26: FileSystems in Linux (Part 1)
 
Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals Course 102: Lecture 19: Using Signals
Course 102: Lecture 19: Using Signals
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers Course 102: Lecture 25: Devices and Device Drivers
Course 102: Lecture 25: Devices and Device Drivers
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
 
Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling Course 102: Lecture 12: Basic Text Handling
Course 102: Lecture 12: Basic Text Handling
 
User Administration in Linux
User Administration in LinuxUser Administration in Linux
User Administration in Linux
 
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
 
Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 28: Virtual FileSystems Course 102: Lecture 28: Virtual FileSystems
Course 102: Lecture 28: Virtual FileSystems
 
Shell & Shell Script
Shell & Shell Script Shell & Shell Script
Shell & Shell Script
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Linux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell ScriptingLinux systems - Linux Commands and Shell Scripting
Linux systems - Linux Commands and Shell Scripting
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 

Viewers also liked

Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land Ahmed El-Arabawy
 
Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 2: Introduction to Operating Systems Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 2: Introduction to Operating Systems Ahmed El-Arabawy
 
Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 6: Installing Ubuntu Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 6: Installing Ubuntu Ahmed El-Arabawy
 
Course 101: Lecture 1: Introduction to Embedded Systems
Course 101: Lecture 1: Introduction to Embedded SystemsCourse 101: Lecture 1: Introduction to Embedded Systems
Course 101: Lecture 1: Introduction to Embedded SystemsAhmed El-Arabawy
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsAhmed El-Arabawy
 
Course 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesCourse 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesAhmed El-Arabawy
 
Embedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 6: Linux & GNUEmbedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 6: Linux & GNUAhmed El-Arabawy
 
Embedded Systems: Lecture 8: The Raspberry Pi as a Linux Box
Embedded Systems: Lecture 8: The Raspberry Pi as a Linux BoxEmbedded Systems: Lecture 8: The Raspberry Pi as a Linux Box
Embedded Systems: Lecture 8: The Raspberry Pi as a Linux BoxAhmed El-Arabawy
 
Embedded Systems: Lecture 5: A Tour in RTOS Land
Embedded Systems: Lecture 5: A Tour in RTOS LandEmbedded Systems: Lecture 5: A Tour in RTOS Land
Embedded Systems: Lecture 5: A Tour in RTOS LandAhmed El-Arabawy
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Ahmed El-Arabawy
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Ahmed El-Arabawy
 
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry PiEmbedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry PiAhmed El-Arabawy
 
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi APEmbedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi APAhmed El-Arabawy
 
Embedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 4: Selecting the Proper RTOSEmbedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 4: Selecting the Proper RTOSAhmed El-Arabawy
 
Embedded Systems: Lecture 2: Introduction to Embedded Systems
Embedded Systems: Lecture 2: Introduction to Embedded SystemsEmbedded Systems: Lecture 2: Introduction to Embedded Systems
Embedded Systems: Lecture 2: Introduction to Embedded SystemsAhmed El-Arabawy
 

Viewers also liked (15)

Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land Course 101: Lecture 4: A Tour in RTOS Land
Course 101: Lecture 4: A Tour in RTOS Land
 
Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 2: Introduction to Operating Systems Course 101: Lecture 2: Introduction to Operating Systems
Course 101: Lecture 2: Introduction to Operating Systems
 
Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 6: Installing Ubuntu Course 101: Lecture 6: Installing Ubuntu
Course 101: Lecture 6: Installing Ubuntu
 
Course 101: Lecture 1: Introduction to Embedded Systems
Course 101: Lecture 1: Introduction to Embedded SystemsCourse 101: Lecture 1: Introduction to Embedded Systems
Course 101: Lecture 1: Introduction to Embedded Systems
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and Permissions
 
Course 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment VariablesCourse 102: Lecture 11: Environment Variables
Course 102: Lecture 11: Environment Variables
 
Embedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 6: Linux & GNUEmbedded Systems: Lecture 6: Linux & GNU
Embedded Systems: Lecture 6: Linux & GNU
 
Embedded Systems: Lecture 8: The Raspberry Pi as a Linux Box
Embedded Systems: Lecture 8: The Raspberry Pi as a Linux BoxEmbedded Systems: Lecture 8: The Raspberry Pi as a Linux Box
Embedded Systems: Lecture 8: The Raspberry Pi as a Linux Box
 
Embedded Systems: Lecture 5: A Tour in RTOS Land
Embedded Systems: Lecture 5: A Tour in RTOS LandEmbedded Systems: Lecture 5: A Tour in RTOS Land
Embedded Systems: Lecture 5: A Tour in RTOS Land
 
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
Embedded Systems: Lecture 10: Introduction to Git & GitHub (Part 1)
 
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
Embedded Systems: Lecture 12: Introduction to Git & GitHub (Part 3)
 
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
Embedded Systems: Lecture 7: Lab 1: Preparing the Raspberry PiEmbedded Systems: Lecture 7: Lab 1: Preparing the Raspberry Pi
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 8: Lab 1: Building a Raspberry Pi Based WiFi APEmbedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
Embedded Systems: Lecture 8: Lab 1: Building a Raspberry Pi Based WiFi AP
 
Embedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 4: Selecting the Proper RTOSEmbedded Systems: Lecture 4: Selecting the Proper RTOS
Embedded Systems: Lecture 4: Selecting the Proper RTOS
 
Embedded Systems: Lecture 2: Introduction to Embedded Systems
Embedded Systems: Lecture 2: Introduction to Embedded SystemsEmbedded Systems: Lecture 2: Introduction to Embedded Systems
Embedded Systems: Lecture 2: Introduction to Embedded Systems
 

Similar to Course 102: Lecture 3: Basic Concepts And Commands

BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS
 
Basic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualBasic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualKuntal Bhowmick
 
Directory Management in Unix
 Directory Management in Unix Directory Management in Unix
Directory Management in UnixVpmv
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file managementAcácio Oliveira
 
Introduction to linux day-3
Introduction to linux day-3Introduction to linux day-3
Introduction to linux day-3Gourav Varma
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdfamitkamble79
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystemroot_fibo
 
intro unix/linux 07
intro unix/linux 07intro unix/linux 07
intro unix/linux 07duquoi
 
Linux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfLinux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfAllinOne746595
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Wave Digitech
 
Linux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersLinux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersDavide Ciambelli
 
Lecture1 2 intro-unix
Lecture1 2 intro-unixLecture1 2 intro-unix
Lecture1 2 intro-unixnghoanganh
 

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

BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
 
LinuxLabBasics.ppt
LinuxLabBasics.pptLinuxLabBasics.ppt
LinuxLabBasics.ppt
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Basic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manualBasic shell programs assignment 1_solution_manual
Basic shell programs assignment 1_solution_manual
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
Directory Management in Unix
 Directory Management in Unix Directory Management in Unix
Directory Management in Unix
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
Directories description
Directories descriptionDirectories description
Directories description
 
Know the UNIX Commands
Know the UNIX CommandsKnow the UNIX Commands
Know the UNIX Commands
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Introduction to linux day-3
Introduction to linux day-3Introduction to linux day-3
Introduction to linux day-3
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
Unit3 browsing the filesystem
Unit3 browsing the filesystemUnit3 browsing the filesystem
Unit3 browsing the filesystem
 
intro unix/linux 07
intro unix/linux 07intro unix/linux 07
intro unix/linux 07
 
Linux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfLinux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdf
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Linux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for BeginnersLinux Bash Shell Cheat Sheet for Beginners
Linux Bash Shell Cheat Sheet for Beginners
 
Lecture1 2 intro-unix
Lecture1 2 intro-unixLecture1 2 intro-unix
Lecture1 2 intro-unix
 

More from Ahmed El-Arabawy

Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Ahmed El-Arabawy
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Ahmed El-Arabawy
 
Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Ahmed El-Arabawy
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Ahmed El-Arabawy
 
Course 102: Lecture 18: Process Life Cycle
Course 102: Lecture 18: Process Life CycleCourse 102: Lecture 18: Process Life Cycle
Course 102: Lecture 18: Process Life CycleAhmed El-Arabawy
 

More from Ahmed El-Arabawy (6)

C 102 lec_29_what_s_next
C 102 lec_29_what_s_nextC 102 lec_29_what_s_next
C 102 lec_29_what_s_next
 
Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)Course 102: Lecture 27: FileSystems in Linux (Part 2)
Course 102: Lecture 27: FileSystems in Linux (Part 2)
 
Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files Course 102: Lecture 24: Archiving and Compression of Files
Course 102: Lecture 24: Archiving and Compression of Files
 
Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts) Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
 
Course 102: Lecture 18: Process Life Cycle
Course 102: Lecture 18: Process Life CycleCourse 102: Lecture 18: Process Life Cycle
Course 102: Lecture 18: Process Life Cycle
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

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)