Comsoft Linux Start
Comsoft Linux Start
Feilke Tobias
Table of Content
Linux?
File Structure
Commands / Tools
Combining Commands
Some facts:
should be avoided
Comparable to a Tree
User: root
Has a group
Tea
Coffee
cd (change directory)
Changes your working folder
Examples:
Example:
pwd
-> /home/sdd
ls (list)
Shows content of local folder
Parameter:
Example:
mkdir /home/sdd/pictures
Creates the directory pictures in folder /home/sdd
mkdir -p /Shortlog/SDD
Creates the directory Shortlog and in Shortlog, the folder
SDD
rm (remove)
Deleting files
rmdir (remove directory)
Deleting folders
Example:
rm SimpleFile delete Simplefile in local folder
cp (copy)
Copy a file or folder
Example:
cp .bashrc mycopy creates a copy of .bashrc named
mycopy
mv (move)
Moves a file or folder
Example:
mv test /home move file test to /home
Usage Example:
grep <text> <path>
find (find)
Search for a specific file
Usage:
find <path> -name <filename>
Example:
find / -name services.cfg Searches for the file
services.cfg starting in the
base folder /.
Usage:
chmod <parameters> <filename>
Example:
chmod 777 executeme.sh Changes the file
permissions, with 777
everyone can read write
and execute the file.
Usage:
chgrp <new group> <filename>
Example:
chgrp sdd log.txt Change the ownergroup of file
log.txt to sdd.
Usage:
chown <new owner> <filename>
Example:
chown sdd log.txt Change the owner of file
log.txt to sdd.
df ()
Display the amount of disk space available on the filesystem
containing each file name in the agrument.
Usage:
df <option> <filename>
Example:
df Displays the available space on all currently
mounted filesystems.
mount ()
Make a storage device available to your system.
Usage:
mount <device> <mountpoint>
Example:
mount /dev/sdb1 /tmp/usb
Makes the storage device sdb1 available at the folder
/tmp/usb. For example a usb pendrive.
umount ()
Release a mount. Write changes to device.
Usage:
umount <mountpoint>
Example:
umount /tmp/usb
Release the mount of /tmp/usb. Now the device could be
removed secure.
vi (editor)
Simple editor available on all unix based distributions
Usage:
vi <file to edit> Open a file
Commands:
i Enter edit mode ESC to leave
:wq Save and exit
:q! Quit without saving
u Undo last action
/<txt> Searches in file for txt
less (reader)
Display content of a file
Usage:
less <file to view> Displays the file
Commands:
/<txt> Search and highlights txt
Arrowkeys to navigate
q Leave file
Usage:
Cat <file to view> Echos the file
Task 1
Go to the home directory.
Task 2
Create a textfile.
Task 3
Copy textfile to the desktop.
Task 4
Create a directory on the desktop.
Task 5
Move the textfile from the desktop to the new folder.
Task 6
Delete the file and the new Folder.
Task 1
Find the file hosts.
Task 2
Get information about the file.
Task 3
List all files starting with z in the /sbin folder.
Task 4
Find the file which contains HelloWorld
Task 5
Copy the HelloWorld file to a usb pendrive.
Task 6
Output only the line containing the word solution from a
file named findme.txt on your local system.