100 likes | 194 Vues
Learn to clear terminal, manage directories, view calendar, check disk space, count file contents, determine file type, and view file beginnings and endings with these useful Linux commands. Enhance your command line skills!
E N D
Using Linux Command 3 Lab#6
Some useful commands [clear] The clear command clears your terminal and returns the command line prompt to the top of the screen. [root@localhost /root]#clear
Directories [rmdir] rmdir—Remove empty directories #rmdir dir1
cal[[0-12] 1--9999] Prints out a nicely formatted calendar of the current month, or a specified month, or a specified whole year. [root@localhost /root]#cal 1947
df Stands for disk free This tells you how much free space is left on your system. [root@localhost /root]#df -h
free Prints out available free memory. You will notice two listings: swap space and physical memory. [root@localhost /root]#free
wc wc [-c] [-w] [-l] <filename> Counts the number characters/bytes(with -c),words(with -w) or lines (with-l) in a file. [root@localhost /root]#wc –c /etc/passwd
Determining file type file <filename> This command prints out the type of data contained in a file. will tell you that portrate.jpg is a JPEG image data, # file portrate.jpg
head Syntax: head [-count | -nnumber]filename This command will display the first few lines of a file. By default, the first 10 lines of a file are displayed. However, you could use the preceding options to specify a different number of lines. # Outline of future projects ff Last modified: 02/02/99 [root@localhost /root]#head -2 doc.txt
tail [root@localhost /root]# tail -50 doc.txt [root@localhost /root]# tail -r doc.txt