linux Flashcards
command to list out all the files or directories available in a directory
ls
This command lists the account name associated with the current login.
whoami
Sometime you might be interested to know who is logged in to the computer at the same time.
There are three commands available to get you this information, based on how much you wish to know about the other users:
users, who, w
command to get a count of the total number of lines, words, and characters contained in a file
wc
$ wc filename
2 19 103 filename
$
display content of a file and the line numbers
cat -n
cat -b (this will not count numbers of empty lines)
$ cat -b filename
1 This is unix file….I created it for the first time…..
2 I’m going to save this content in this file.
$
command to make a copy of a file
cp
$ cp source_file destination_file
command to change the name of a file
mv
$ mv old_file new_file
command to delete a file
rm
$ rm filename
formatted directory listing with hidden files
ls -al or ls -la
change to a directory
cd
show current directory
pwd
create a directory
mkdir
output the contents of a file as it grows
tail -f file
show kernal config
uname -a
show this months calendar
cal
show current date/time
date
show uptime
uptime
cpu info
cat /proc/cpuinfo
memory info
cat /proc/meminfo
show disk usage
df
show directory space usage
du
and du -sh for human readable version
show memory and swap usage
free
show possible locations of app
whereis app
search for a pattern in files
grep [pattern] files
grep -r pattern dir = search recursively for pattern in dir
command | grep pattern = search for the pattern in the output of the command