File and directory handling via the terminal
File handling isn't always easy, but we got you covered. The hackeroOS terminal offers different commands for editing moving and deleting files.
For all of these commands, you can find help by using the --help
flag! So e.g. if you want to know how the cd
command works, type cd --help
to get an explanation and examples.!
Viewing directories and files
Directories
If you want to list all directories use the ls
command. doing so will result in a list of all files and directories like the following:
shrimps@213.71.60.191:# / ls
README.md me cracker.bin downloads www config logs
The entries have different colors for different types:
- blue for normal files
- red for executables
- green for directories
You can also show the directory content as a list by adding the -l
flag which results in an output like this:
shrimps@213.71.60.191:# / ls -l
file README.md
dir me
exec cracker.bin
dir downloads
dir www
dir config
dir logs
Colors are here the same as describe earlier.
Directories and files can also be hidden by prefixing them with a dot (.
). They are hidden by default, but you can make them visible by using the -a
shrimps@213.71.60.191:# / ls -a
README.md me cracker.bin downloads www config logs .hidden
this also works in combination the -l
flag as well.
Files
To show the content of a file you can use the cat
command or the stat
command.
With the cat
command you get the content of a normal file:
shrimps@213.71.60.191:# /logs/ cat system
[2019-07-20 14:02:26] localhost has installed software cracker
[2019-07-20 14:10:49] uploaded file README.md to 1.1.1.1
You cannot print the content of an executable that way. for them you have to use the stat
command which will show the executables information like filesize or level:
shrimps@213.71.60.191:# / stat cracker.bin
Type cracker
Version 1.5
Size 45MB
Navigation
To navigate through directories you use the cd
command. You need to specify a directory relative to your current directory you want to navigate to. E.g. if you want to navigate from /
to /mydirectory/
you type cd mydirectory
. Not specifying a path always results in going back to the root (/
). To go a directory upwards use two dots cd ..
. You can also chain these e.g. to go from /dir1/
to /dir2/
you enter cd ../dir2
Create Directories
Creating a directory is really easy. Use mkdir
to create a directory.
shrimps@213.71.60.191:# / mkdir foo
shrimps@213.71.60.191:# / ls
README.md me cracker.bin downloads www config logs foo
shrimps@213.71.60.191:# /
Remove files and directories
To remove a file, use rm [filename]
shrimps@213.71.60.191:# / rm bar.txt
To remove a directory you must add the -r
flag
shrimps@213.71.60.191:# / rm dir1 -r