Starting Unix
Starting Unix
• Some of the more common flags you can use with ls are follows:
• -r >> Reverses the order of how the files are displayed
• -t >> Orders the files in modification time.
• -l >> Shows you huge amounts of information (permissions,
owners, size, and when last modified.)
• -a >> Shows all files including the . , .., and all hidden files
Basic Commands
ls
• You can also list the contents of a directory that you aren’t even in
by passing the full pathname to the directory (either in relative or
absolute terms) to the ls command such as below.
Basic Commands
ls
• If you want to list all the files in the current directory that begin with
Onevu for example you can use a wildcard (*) such as
Basic Commands
mkdir
• The mkdir is the same basically in windows it makes a directory in
the current directory that you are in
• The syntax is simply “mkdir directoryName”
• cat file1.txt >> file2.txt: what the “>>” does it tell the process “if file2.txt doesn’t exist create it and if it does append
file1.txt to the bottom”
Basic Commands
cp
• cp is used to copy files. The basic syntax for this is:
cp file1.txt file2.txt
• This will copy file1.txt to file2.txt, now you can include a
path infront of the filenames to specify where they are if
they are not in the current working directory
• By adding the –p flag to a cp command it will cause the
new file created to retain the same permissions as the
original file
Basic Commands
mv
• mv is used for moving or renaming a file.
It is almost identical in process to cp
however it removes the original file.
Basic Commands
rm
• rm is used to remove a file or directory. The syntax would be as
follows:
rm file.txt
• In the event that you run a process in the foreground that you need
to run in the background, what you can do is hit ctrl+z to temporarily
stop the process. From there you will be given an ID for the job: