tut 2 Flashcards
ls -atouch test.txt
creates a file called “test.txt”
man ls
shows all the ls commands
ls -a or ls -a -1
shows all the hidden entries (files)
ls -1
lists down all the files in a single line/single entry
ls -1 | wc -l
shows all the files in the directory
ls -1a | wc -l
shows all the files + the hidden files in the directory.
ls -a1R
shows all the content in the sub directories also
mkdir -newdir
makes a new directory
mkdir -newdir
touch -file1
ls
creates a new file called “file1” under “newdir” and ls lets us see the new file under the new directory.
mkdir -newdir
touch -file1
ls
echo “hello world”»_space; file1
cat file1
output: hello world
this script creates a new file in the new directory and adds in a sentence called “hello world”, using the cat command helps us to see the content in file1.
cp file1 file2
copies content from file1 to file2
mv file1 file3
ls
output: file2 file 3
(ls replaces the file1 with file3)
mv file3 ..
file 3 is moved to the parent directory, as known as desktop (moves 1 level up)
mv file3 ..
ls
ls /home/ict246/Desktop
OR
ls ~/Desktop
OR
ls ..
ls just shows the list of files in the current directory, so the output is file2
the last command tells us the list of files in the Desktop so file3 is included in the list of files.
mv ../file3
ls
this moves file3 from the desktop to the current directory user is working in.
output: file2 file3