UNIX commands can often be grouped together to make even more powerful commands with capabilities known as I/O redirection ( for outputing to a file ) and piping using to feed the output of one command as input to the next. Please investigate manuals in the lab for more examples than the few offered. Unix Commands Unix commands are programs that are supplied with the Unix OS to do specific tasks. They generally act like: command arguments Unlike your PC or Mac, instead of clicking a program icon, you type a program name in the terminal window. For example, type the following: date Date is an example of a Unix command. Describe all UNIX commands in details, but instead I picked commands that are useful and interesting from a user’s point of view. Most of the commands described in this reference card are explained in my UNIX and Internet book which is written in “Bahasa Indonesia” )Indonesian language.) Rahardjo, Budi (1994), Buku Pegangan Sistem Unix. Remove all files on the system with such a command executed on the top of your directory tree, and there is no undelete in Linux (yet). But if you really wanted to do it (reconsider), here is how (as. Are required between commands and options and between options and each argument. Commands must be typed in the proper case (nearly always lower case). Although each option to a command may be pre xed by a -', with almost all of the standard commands you may put the options together. For example command -a -b -c -d can often be abbreviated as.
by Sandeep on Sep 14, 2012
Basic Linux Commands. File Handling. Text Processing. System Administration. Process Management. Archival. Network. File Systems. Basic Commands (3).To list the contents of a directory, use the ls command login4$ ls.To see all files and directories, including hidden ones use the -a flag with the ls command. Hidden files have a ^. In front of them login4$ ls –a 17 Note: your current working directory can be checked by using the pwd command.
TweetrmUse rm to delete either ordinary files, or directories that have files in them. You must have permission to write to the directory that contains a file if you want to delete that file. To delete an individual file:
rm combined.txt
You can specify more than one file to remove with a single command. Use the “-i” feature to have rm prompt you before removal of each file.
rm -i file1 file2
Use the “-f” switch to remove write-protected files without prompting you. This will “force” the removal.
rm -f file1
And, finally, use “-r” or “-R” to remove a directory along with any of its contents, including any subdirectories. This is a very dangerous command so beware!!!!!
rm -rfv
Practice Using rm and Wildcards
When practicing with the rm command move to a directory where you are less likely to do damage,seriously. Create a test_dir directory and move into the directory to do your work.
mkdir test_dir
cd test_dir
cp /etc/*.conf /home/user_name/test_dir
ls
dovecot.conf libaudit.conf nsswitch.conf updatedb.conf
gpm-root.conf libuser.conf ntp.conf warnquota.conf
host.conf logrotate.conf resolv.conf xinetd.conf
initlog.conf mke2fs.conf sensors.conf yum.conf
jwhois.conf multipath.conf sestatus.conf
krb5.conf named.caching-nameserver.conf sysctl.conf
ld.so.conf nscd.conf syslog.conf
Your list of files may be a little different but you get the picture.
rm k*
You will have deleted all files that start with “k”. Now use the interactive removal. Here you are requred to confirm the removal of each file, safer…but good if it is only a few files.
rm -i l*
rm: remove regular file `ld.so.conf'? y
rm: remove regular file `libao.conf'? n
rm: remove regular file `libaudit.conf'? y
rm: remove regular file `logrotate.conf'? y
Now create an alias that will always ask when you want to remove files, making sure you do not make any mistakes.
cd ~
vi .bashrc
Add the alias.
alias rm='rm -i'
Save and run the source command to make it active immediately.
source .bashrc
cd test_dir
rm m*
rm: remove regular file `mke2fs.conf'? y
rm: remove regular file `mtools.conf'? y
So now you can see the value of creating an alias to keep you out of trouble. But what if you want to remove a group of files without having to say yes to each one, use the “-f” option to force the removal even with the alias.
rm -f r*
List Of All Unix Commands With Examples Pdf Files
Here is another option, what if you are only want to know when you are going to rmeove more that 3 files, use the “-I” switch.
rm -I d*
If there are three or less files to remove, no confirmation will occur. However, if there are more than three files you will need to confirm the removal of all files.
Common Unix Commands Pdf
rm -I *.conf
rm: remove all arguments?