Posted: . At: 10:09 PM. This was 12 years ago. Post ID: 3110
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.

Even more useful Linux command-line tips and information.

Even more useful Linux command-line tips and information

How large in total are the contents of a folder? This command will print that for you. This is the total disk usage of all files in the current folder.

ubuntu ~ $ sudo du -ackh /usr | tail -n 1
2.7G    total

To copy and paste text from an xterm window if you are using a tiling window manager like Awesome as I am at the moment and you can not use Ctrl-C & Ctrl-V, then simply highlight the desired text in the xterm and press both mouse buttons at once, this will copy the text to a buffer. Then you may paste the text in the desired place with the middle mouse button. If you highlight a command with the mouse and press the middle mouse button, then the text will be copied and pasted in one operation, this may not always be what you want. I have used this to copy from an xterm window to the Firefox web browser and it worked a treat. This is the traditional way of copying and pasting text in X.

To close an xterm you have no need of, you may type exit in the terminal prompt, or you can press Ctrl-D and this will also close the terminal window.

This command will print the disk space remaining on the root / folder.

ubuntu ~ $ df -Hla / | head -n 2
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1       32G   28G  3.0G  91% /

And this command will print all processes that your user is running.

ubuntu ~ $ ps aux | grep $LOGNAME
root     17673  0.0  0.1 107748  1136 ?        Ss   21:59   0:00 sshd: ubuntu [priv]
ubuntu   17776  0.0  0.1 107896  1224 ?        S    21:59   0:00 sshd: ubuntu@pts/0
ubuntu   17779  0.0  0.0   4452   152 pts/0    Ss   21:59   0:00 -sh
ubuntu   17783  0.0  0.3  22080  3456 pts/0    S    21:59   0:00 bash
ubuntu   17816  0.0  0.1  17172  1276 pts/0    R+   22:03   0:00 ps aux
ubuntu   17817  0.0  0.0  10472   904 pts/0    S+   22:03   0:00 grep --color=auto ubuntu

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.